import { decode, encode } from "html-entities";
import { ComponentPropsWithoutRef, memo, useCallback, useState } from "react";
import { Main, MainItem, TextField } from "@/components/common";
type TextFieldValue = ComponentPropsWithoutRef["value"];
type OnTextFieldChange = NonNullable["onChange"]>;
type Props = {
decoded: TextFieldValue;
encoded: TextFieldValue;
onDecodedChange: OnTextFieldChange;
onEncodedChange: OnTextFieldChange;
};
const StyledComponent = ({ decoded, encoded, onDecodedChange, onEncodedChange }: Props) => (
);
export const Component = memo(StyledComponent);
const Container = () => {
const [decoded, setDecoded] = useState("");
const [encoded, setEncoded] = useState("<Hello World>");
const onDecodedChange: Props["onDecodedChange"] = useCallback(({ currentTarget: { value } }) => {
setDecoded(value);
setEncoded(encode(value));
}, []);
const onEncodedChange: Props["onEncodedChange"] = useCallback(({ currentTarget: { value } }) => {
setEncoded(value);
setDecoded(decode(value));
}, []);
return ;
};
export default Container;