I followed the tutorial yet this error isn't being solved](https://i.stack.imgur.com/2qNEF.jpg)
I tried to use {} instead of [] but still the same error occurs
I followed the tutorial yet this error isn't being solved](https://i.stack.imgur.com/2qNEF.jpg)
I tried to use {} instead of [] but still the same error occurs
your useContext return null. And you try to destructure null. If you don't provide array in context provider value then you can't write:
const [a1, a2] = ....
So probably you miss match useState
const [state, setState] = useState
with context
const context = useContext(Context)
So. Just write:
const balance = useContext(BalanceContext);
console.log('balance context:',balance)
and then you will see what is in balance context. if is a object then you have to destructure object.
ps. quick fix to run project:
const [balance, setBalanace] = useContext(BalanceContext) || [];
// balance and setBalance is undefined