How to use React.memo with react-redux connect?

React.memo is nothing but a HOC, so you can just use:

Without memo:

connect(
  mapStateToProps,
  mapDispatchToProps
)(Button);

With memo:

connect(
  mapStateToProps,
  mapDispatchToProps
)(React.memo(Button));

And even wrap to connect: (This should be the solution with connect)

React.memo(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(Button)
);

Like we do with withRouter: withRouter(connect(...)())

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)