i got this error in react = index.tsx:963 Uncaught TypeError: Cannot destructure property ‘basename’ of ‘react__WEBPACK_IMPORTED_MODULE_0__.useContext(…)’ as it is null.
In the code below, I am trying to pass the query entered by the user in the search bar from the header component to another component using props, as shown below.
in head.js i have this code
<Link to="/results">
< SearchVideo results={searchResult} loading={loading} />
</Link>
this is my app.js
const appRouter = createBrowserRouter([{
path: "/",
element: <Body />,
children: [
{
path: "/",
element: <MainContainer />,
},
{
path: "watch",
element: <WatchPage />,
},
{
path: "results",
element: <SearchVideo />,
},
],
}]);
function App() {
return (
<Provider store={store}>
<div className="bg-black ">
<Head />
<RouterProvider router={appRouter}/>
</div>
</Provider>
);
}
export default App;
this is my index.js
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<App />
);
i have one reactapp which have bug so want solution