Get version number from package.json in React Redux (create-react-app)

Solving this without importing and exposing package.json to the create-react-app Requires: version 1.1.0+ of create-react-app .env REACT_APP_VERSION=$npm_package_version REACT_APP_NAME=$npm_package_name index.js console.log(`${process.env.REACT_APP_NAME} ${process.env.REACT_APP_VERSION}`) Note: the version (and many other npm config params) can be accessed Note 2: changes to the .env file will be picked only after you restart the development server

Redux Presentational Components Vs Container Component

You’ll find your components much easier to reuse and reason about if you divide them into two categories. I call them Container and Presentational components. I assume you have knowledge about redux architecture Container Components Aware of redux Subscribe redux state Dispatch to redux actions Generated by react-redux Focus on how things work Presentational Componets … Read more

Changing the layout of a component depending on Redux state

connect state on your Child components Using connect on child components has the following advantages: Your parent component need not bother about connecting all the props required by its children even though the parent itself is not using the prop. Child components become more reusable, and easily maintainable. Avoids passing down props blindly from parent … Read more