R
Reactiflux

_mercury – 19-25 Aug 15

_mercury – 19-25 Aug 15

M_mercury8/15/2022
what could be wrong here ?
M_mercury8/15/2022
this route is working if i did it by a browser
const getAttributes = async () => {
const res = await fetch('/api/attributes');
console.log('res', res);

const attrs = await res.json();
console.log('d', attrs);
setAttributes(attrs);
};

useEffect(() => {
getAttributes();
}, []);
const getAttributes = async () => {
const res = await fetch('/api/attributes');
console.log('res', res);

const attrs = await res.json();
console.log('d', attrs);
setAttributes(attrs);
};

useEffect(() => {
getAttributes();
}, []);
UUUnknown User8/15/2022
Message Not Public
Sign In & Join Server To View
M_mercury8/15/2022
console.log('res', res); not appear and method not called
UUUnknown User8/15/2022
Message Not Public
Sign In & Join Server To View
M_mercury8/15/2022
I called it in useEffect ?
UUUnknown User8/15/2022
2 Messages Not Public
Sign In & Join Server To View
M_mercury8/15/2022
I have another Error in the code may be it stops react
UUUnknown User8/15/2022
Message Not Public
Sign In & Join Server To View
M_mercury8/15/2022
yes i removed the comp that creates the erropr And i see it works thx
UUUnknown User8/16/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

_mercury – 19-25 Aug 15

Join Server