Software Alternatives & Reviews

What is the correct way to store a variable so that It is accessible to all components/pages?

Redux.js react-context React Redux
  1. Predictable state container for JavaScript apps
    Pricing:
    • Open Source
    If you have a more complex component hierarchy, and the component who receives the DB response is not on the top, you might consider introducing a State management tool, such as Redux: https://redux.js.org / https://react-redux.js.org.

    #Javascript UI Libraries #JS Library #Front-End Frameworks 165 social mentions

  2. Context provides a way to pass data through the component tree without having to pass props down manually at every level.
    If the component that does the fetch and receives the response from the DB is in the top of the component tree, then you could use React’s in-built Context API, and then you can provide that data to ALL the children components: https://reactjs.org/docs/context.html.

    #Javascript UI Libraries #Front-End Frameworks #JS Library 207 social mentions

  3. Official React bindings for Redux
    Pricing:
    • Open Source
    If you have a more complex component hierarchy, and the component who receives the DB response is not on the top, you might consider introducing a State management tool, such as Redux: https://redux.js.org / https://react-redux.js.org.

    #Javascript UI Libraries #JS Library #Front-End Frameworks 20 social mentions

Discuss: What is the correct way to store a variable so that It is accessible to all components/pages?

Log in or Post with