Exploring the React Context API with Provider and Consumer

  • It explains how to use React’s new context API for passing props down the component tree.
  • Basically, React’s context API takes the clutter away of passing mandatory props, that are needed by every component, down your whole component tree.
  • Therefore you could use React’s context API to give every component access to the colored theme.
  • As you can imagine, following this way every component that needs to be styled according to the colored theme could get the necessary information from React’s context API by using the Consumer component now.
  • This Provider component uses React’s context API to pass down the state implicitly.

React’s Context API is a powerful feature for passing props down the component tree without the need to tell components in between about them. React’s context creates a Provider and Consumer component that enable us to use this powerful feature …
Continue reading “Exploring the React Context API with Provider and Consumer”

How to use React’s Provider Pattern

How to use React's Provider Pattern  #reactjs #webdev

  • Therefore you could use React’s context to give every component access to the colored theme.
  • That way every component that needs to be styled according to the colored theme could get the necessary information from React’s context object.
  • You have the Provider component that makes properties accessible in React’s context and components that consume the context.
  • This Provider component uses React’s context to pass down the state implicitly.
  • You provide the state to your component as props, the component wraps it into React’s context and all child components can access the state by using a higher order component such as from the react-redux library.

This article gives you a walkthrough for React’s provider pattern. After reading it, you should be able to implement…
Continue reading “How to use React’s Provider Pattern”

How to use React’s Provider Pattern

  • Therefore you could use React’s context to give every component access to the colored theme.
  • That way every component that needs to be styled according to the colored theme could get the necessary information from React’s context object.
  • You have the Provider component that makes properties accessible in React’s context and components that consume the context.
  • This Provider component uses React’s context to pass down the state implicitly.
  • You provide the state to your component as props, the component wraps it into React’s context and all child components can access the state by using a higher order component such as from the react-redux library.

This article gives you a walkthrough for React’s provider pattern. After reading it, you should be able to implement…
Continue reading “How to use React’s Provider Pattern”

React, Redux and react-redux

  • The List component renders our list.
  • The Provider component “provides” the store for our app so you can “connect” to it using connect() .
  • We’ll have an input box that sets the state and then finally our List component with items and what to filter on.
  • First we want to remove the static state from our FilterList component and get it from the store.
  • But as you know by now, we keep the state in the store so we need to update the store somehow…

React and Redux are great. Once you get the basics it’s really easy to create very cool web apps. This is what I liked about Angular 1.x, you would read a small tutorial and be able to build an app within hours. React on the other hand – while also being quite easy to get into – is a bit harder.
Continue reading “React, Redux and react-redux”