I have a doubt regarding the async await part for getting contacts . I heard using async directly inside useEffect is not a good practice / ❌ Don't do this! useEffect(async () => { const users = await fetchUsers(); setUsers(users); return () => { // this never gets called, hello memory leaks... }; }, []); This WORKS, but you should avoid it. Why? Because React’s useEffect hook expects a cleanup function returned from it which is called when the component unmounts. Using an async function here will cause a bug as the cleanup function will never get called. use this way instead useEffect(() => { const getUsers = async () => { const users = await fetchUsers(); setUsers(users); }; getUsers(); // run it, run it return () => { // this now gets called when the component unmounts }; }, []); Thanks
To correct the useEffect() hook error - async await part for getting contacts - change your code to: useEffect(() => { async function handleResp(){ try{} catch{} }; handleResp(); }, []); ------------------------- New version of react throws errors if you use async () => {}
Thank You So Much For This comment bro Bhai Ek din pura gaya Aur dusare din comment dekhne laga to Aapka Comment Dikha Aur Error Fix Huaa Etni Khushi horahi Hai kya Bata U Apko THenk You So Much Once Again Bro
dont know what methods you are using but after 1:16:00 nothing is running. This code is shows error where using colon(:) useState(initialState:{ , useEffect(effects: ....... and so many errors.
Can anyone tell me how to deploy this project ?? Both server part and src-component. I made delopy using npm build and netlify but contact detail is not displaying..pls help
I am getting an error Failed to compile. ./src/components/contacts/ContactList/ContactList.jsx Line 6: Parsing error: The type cast expression is expected to be wrapped with parenthesis. 4 | 5 | let ContactList = () => { > 6 | let [state,setState] = useState(initialState:{ | ^ 7 | loading :false, 8 | contacts : [], 9 | errorMessage : ''
Sir please deploy it in netlify and show us. Am having error after deployed in netlify. I put separate folder for server. Is this the issue. If i run locally by starting both client and server, it is working properly. But after deployment it is not working it cannot able to get /contacts.please help me
Hello sir. Please I getting this error when using the POST API function error: Unhandled Runtime Error TypeError: func.apply is not a function Call Stack HTMLUnknownElement.callCallback
so there is one problem with the database when u are trying to open it in a new browser so the record u are trying to select for groups so should not accessible so what actually solutions for the same try that once u will get it and nice thing learn
Hello everyone. I'm facing an issue while launching my app after intalling firebase. The error message is "Module not found: Error: Package path . is not exported from package". It's asking me to see exports field in package.json Can someone help me go through this please?
@@pochankiTuber How did you resolve the issue? I'm getting a "useEffect must not return anything besides a function...instead, write async function inside your effect and call it immediately."
Felicitaciones y gracias por éste tremendo tutorial, está de lujo, pero el vsc me dá error en el 1:19:00, no me reconoce y no puedo avanzar... nosé cuál es mi error... ayuda por favor. HELP
1:19:15 i am getting syntax error from there. Its showing Error: The type cast expression is expected to be wrapped with parenthesis when using get function ,Expected ',' etc
Hola,yo también tengo ésa pregunta, él vsc me da error justamente en éste momento, no puedo avanzar y no sé lo que es, simplemente me atasqué ahí. Estoy desesperada porque no he podido descubrir la respuesta.
@@gabyzapata9183 use direct object without giving it a name (initialState) your problem will be solved. But then again you will get stuck in contactList page where you will call your data from json-server.