Error is
Uncaught TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
import React from 'react';
import { NavigationBar } from './components/header/Navbar';
import {Outlet} from "react-router-dom"
export default function App(){
const [account, setAccount] = React.useState<string>('')
return (
<div className="App">
<NavigationBar />
<Outlet context={[account, setAccount]}/>
</div>
);
}
I am getting error on the line const {account, setAccount} = useOutletContext();
Below is the snippet of code where account and setAccount is needed.
import { useOutletContext } from "react-router-dom";
const NavigationBar:React.FC = () => {
const [account, setAccount] = useOutletContext();
// rest of the code
}