0

The functional component:

const NewRestRequestCoreForm = props => {
    const intl = useIntl();
    ....
    return (
        <Container>
        ....
        </Container>
    );
}

export default React.memo(NewRestRequestCoreForm);

WebStorm shows me this error/warning:

Argument type function(any): JSX.Element is not assignable to parameter type SFC<object> ...
Type function(any): JSX.Element is not assignable to type FunctionComponent<object>
Type JSX.Element is not assignable to type ReactElement<any, any> | null 

I simply want to cache this component so when the parent changes but the props passed to NewRestRequestCoreForm don't, NewRestRequestCoreForm does not get re-rendered.

The component is used like this:

<NewRestRequestCoreForm a={a}/>

What I'm doing wrong and how can I fix this?

EDIT:

I just used a simple Component with and without applying memo and it works even with the warning!

LazyOne
  • 158,824
  • 45
  • 388
  • 391
usertest
  • 2,140
  • 4
  • 32
  • 51

0 Answers0