Ash
Ash

Reputation: 574

Error using React.memo() over stateless component

Using react 16.6 I am trying to use memo with stateless component but I get an error.

Error

react-dom.development.js:57 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Code:

const MyComponent = () => (
  <React.Fragment>
    TEST
  </React.Fragment>
);

export default React.memo(MyComponent);

Upvotes: 1

Views: 1223

Answers (1)

daniula
daniula

Reputation: 7028

You should update react-dom to the ^16.6.0 version, too.

Upvotes: 6

Related Questions