...
<RegulationEditWindow setIsEditing={setIsEditing} />
...
interface RegulationEditWindowProps {
setIsEditing(editing: boolean): void;
}
const RegulationEditWindowView: React.FC<RegulationEditWindowProps> = React.memo((props) => {
...
<ArrowLeftOutlined onClick={() => props.setIsEditing(false)} />
...
});
function func(a) { console.log('***', a); }
const funcStr = func.toString();
...
const parsedFunc = Function('return ' + funcStr)();
parsedFunc(12); // в консоли: *** 12
formData.append('MAX_FILE_SIZE', '12345678'); // или сколько там
formData.append('file', file);
const Container = () => {
const [shownItemId, setsShownItemId] = useState('');
.....
<ContainerItem itemId={id} onShowDetails={() => setsShownItemId(id)} ... />
.....
{shownItemId && <Modal itemId={shownItemId} ... />
};
type Pr = {
set: React.Dispatch<React.SetStateAction<string>>
}
const Gliph: React.FC<Pr> = React.memo(({ set }) => {
console.log('render Gliph')
const handleClick = (letter: string) => {
set((value) => value + letter)
}
return (
<>
{alphabet.map((l) => (
<button type="button" key={l} className="gliphMine" onClick={() => handleClick(l)}>
{l}
</button>
))}
</>
)
})
export const App: React.FC = () => {
const [value, setValue] = useState('')
console.log('render App')
return (
<div>
<input className="inputLine" value={value} readOnly />
<Gliph set={setValue} />
</div>
)
}
const notesStorage = JSON.parse(localStorage.getItem('notes') || '[]');
dispatch(setNotesAction(notesStorage));
const notesRedux = useSelector((state: any) => state.notes.items);