Using Higher Order Components in a React Application

  • If you have started using ReactJS recently often you might have felt that you are performing repeated logic in many components.
  • Well Higher Order Component (HOC) provides solution to such a kind of problems.
  • A function (Functional component in React) which takes a component and gives back another component.
  • So the exact benefits are:

    Functional components started from React V15.

  • But apart from that if we are careful enough we can have an architecture which can abstract logic that can be shared across other presentational components using HOC has great benefits.

If you have started using ReactJS recently often you might have felt that you are performing repeated logic in many components. For example consider an app having:
Continue reading “Using Higher Order Components in a React Application”

A gentle Introduction to Higher Order Components

A gentle Introduction to Higher Order Components:  by @rwieruch #JavaScript #ReactJS

  • I want to pick out one use case, the conditional rendering with higher order components, to give you two outcomes from this article as a reader.
  • First, it should teach you about higher order components with the use case of conditional rendering.
  • Keep in mind, that altering the look of a component with a higher order component, specifically in the context of conditional rendering, is only one of several use cases to use HOCs.
  • In order to teach higher order components, the article focuses on the use case of conditional rendering.
  • Now you could use the higher order component but with a function that determines the conditional rendering.

Higher order components, or known under the abbreviation HOCs, are often a hard to grasp pattern in React. The article gives you an introduction to HOCs, how to use them elegantly in the case of conditional rendering and how to abstract them…
Continue reading “A gentle Introduction to Higher Order Components”

A gentle Introduction to Higher Order Components

  • I want to pick out one use case, the conditional rendering with higher order components, to give you two outcomes from this article as a reader.
  • First, it should teach you about higher order components with the use case of conditional rendering.
  • Keep in mind, that altering the look of a component with a higher order component, specifically in the context of conditional rendering, is only one of several use cases to use HOCs.
  • In order to teach higher order components, the article focuses on the use case of conditional rendering.
  • Now you could use the higher order component but with a function that determines the conditional rendering.

Higher order components, or known under the abbreviation HOCs, are often a hard to grasp pattern in React. The article gives you an introduction to HOCs, how to use them elegantly in the case of conditional rendering and how to abstract them…
Continue reading “A gentle Introduction to Higher Order Components”

Handling AJAX in your React Application with Agility

Handling #AJAX in your #React Application with #Agility  #reactjs #JavaScript #JStutorial

  • If the operation fails, it’s good practice to dispatch failure action, which in our case is LOAD_USER_FAILURE .
  • Redux-thunk allows an action creator to return a function instead of an action object.
  • When an action creator returns a function, that function will get executed by the Redux Thunk middleware.
  • Map the store’s state to component’s props.
  • Component { constructor() { super(); } componentDidMount() { this.props.getUserDetails(‘andela-rekemezie’); } render() { const { user } = this.props; return ( // Render user details ) } } // Store setup goes

There are different ways to handle AJAX with React. This tutorial will show you some ways to do it. Let’s get started.
Continue reading “Handling AJAX in your React Application with Agility”

Handling React Forms with Mobx Observables

  • Handling React Forms with Mobx Observables
  • I don’t need an onChange handler in my form component anymore.
  • The form data and the input value is updated through an onChange handler.
  • We simply have to pass a submit handler to the form component.
  • We imported the asForm HOC and wrapped the address component, indicating which props has the form data.

Learn a single approach to handle React forms with Mobx observables without using an already existing form library. Advanced techniques and patterns inside.
Continue reading “Handling React Forms with Mobx Observables”

Handling React Forms with Mobx Observables

Handle #ReactJS forms with Mobx observables:

  • Handling React Forms with Mobx Observables
  • I don’t need an onChange handler in my form component anymore.
  • The form data and the input value is updated through an onChange handler.
  • We simply have to pass a submit handler to the form component.
  • We imported the asForm HOC and wrapped the address component, indicating which props has the form data.

Read the full article, click here.


@ReactiveConf: “Handle #ReactJS forms with Mobx observables:”


Learn a single approach to handle React forms with Mobx observables without using an already existing form library. Advanced techniques and patterns inside.


Handling React Forms with Mobx Observables