react-yandex-maps icon indicating copy to clipboard operation
react-yandex-maps copied to clipboard

onLoad prop error

Open husanGuru opened this issue 2 years ago • 0 comments

При использовании onLoad свойства для Map, выводит ошибку: Warning: useEffect must not return anything besides a function, which is used for clean-up.

It looks like you wrote useEffect(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:

useEffect(() => { async function fetchData() { // You can await here const response = await MyAPI.getData(someId); // ... } fetchData(); }, [someId]); // Or [] if effect doesn't need props or state

husanGuru avatar Jan 09 '23 14:01 husanGuru