How to send and receive data using React Route?

I have a react-js and a normal javascript part of a project. I figured out how to navigate between the two of them. Now I also want to send data between them. I have this code:

<BrowserRouter>
       <Route exact path="/" render={() => {window.location.href="tv/indexTv.html"}} />
</BrowserRouter>

How can I pass extra data (like a string)? How can I receive it? Or can I somehow pass data to the html, or to a javascript file from my App.js (React) without using route?

Answer

You could use something like redux or the useContext hook to store data: https://reactjs.org/docs/hooks-reference.html#usecontext

or use query params: https://reactgo.com/react-get-query-params/

I’d suggest you use query params, since it is way easier and much less setup