im getting this weird error in console.log while trying to fetch data from a bearer token API
dispatchSetState(fiber, queue, action) {
{
if (typeof arguments[3] === 'function') {
error("State updates from the useState() and useReducer() Hooks don't support the " + 'sec…
after trying to fetch the data from a Bearer token API using Reactjs.
here is my code:
const [result, setResult] = useState();
useEffect(() => {
fetch("https://myapi.com/api/products", {
method: "GET",
headers: { Authorization: `Bearer ${accessToken}` },
})
.then((res) => res.json())
.then((json) => setResult(json));
console.log(setResult);
}, []);
what am i doing wrong?