Downsides of react apps, exporting functional components and thoughts on history and context APIs

Sudipmodi
2 min readFeb 16, 2021
  1. React apps are basically single-page apps, i.e. there is only one page being returned from the server and the page never refreshes, all that react is doing is loading different elements into the dom with javascript and ajax. This has some downsides, for example when a user bookmarks a link from our website he is essentially bookmarking only one link since our app is a single-page app so every link will take the user to the homepage and not to the page that they desire which is bad user experience. To get around this problem we use the HTML history API . But react-router wants to abstract all of that by itself so we use react’s useHistory() hook, seems like reinventing the wheel but okay.
  2. Whenever you make a component as an arrow function do it like this
    Const App = ( ) => {
    }
    export default App;
  3. I feel like concepts such as react-router, context API and history API should be taught at the start of any course, switching pages in react or navigating links is pure HTML is what makes the web a WEB.

These are notes that I am making in the form of stories while learning react, hope anyone who reads this finds it useful.

--

--

Sudipmodi

Full stack engineer and SAP consultant based out of bangalore.