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);
interface FishProps {
imgName: string;
random: number;
}
const Fish: React.FC<FishProps> = (props) => {
...
const fetchPartners = async (params) => {
const id = params.queryKey[1]
const { data } = await axios.get(`/api/v1/shop/partner/${id}`)
return data
}
...
const {data: fetchPartners, isLoading} = useQuery(['partner', id], fetchPartners)