skip to Main Content

Reactjs – react read data after setData

const useCustomState = () => [value, setValue]; const [data, setData] = useCustomState(initValue); useEffect(() => { const fn = async() => { await setData(1); console.log(data); // ouput 1 }; fn(); }, []) How to implement this custom hooks function can get…

VIEW QUESTION

Reactjs is not installing through nodejs command prompt

I have installed the nodejs. However, when i run a command to install reactjs , it throws an error. command prompt: npx create-react-app my-app Error: node:internal/modules/cjs/loader:1080 throw err; ^ Error: Cannot find module 'D:nodenode_modulesnpmbinnpm-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15) at Module._load (node:internal/modules/cjs/loader:922:27)…

VIEW QUESTION
Back To Top
Search