This list includes some of the most popular React design patterns that are efficient for cross-cutting concerns, global data sharing (without prop drilling), the separation of concerns such as complex stateful logic from other component parts, and more.
Below are the patterns:
The higher-order component pattern
In React, a higher-order component is structured as seen below:
import React, {Component} from 'react';
const higherOrderComponent = (DecoratedComponent) => {
class HOC extends Component {
render() {
return <DecoratedComponent />;
} }
return HOC; };