-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create-react-app React performance with SVG as ReactComponent and eslint with React.memo missing display name #26
Comments
whats the point of
? EDIT: i got it, it means it should never re-render because "areEqual" returns "true" |
Sorry, I don't understand. I'm using Am I right? |
I think something like Am I right? |
Yes, that's correct, the function passed as 2nd argument to useMemo() is usually called You can fix the eslint/display-name with const PureProfileIcon = PureComponent(ProfileIcon);
PureProfileIcon.displayName = 'PureProfileIcon'; but that rule is purely useful during development as production will have names minified anyways so. |
i got it, it means it should never re-render because "areEqual" returns "true" |
for the warning:
unless you dont want the component to ever re-render. then you indeed can add
I wouldn't call it "PureComponent" though. If you want a pure component, use React.memo in the first way. If a component never re-renders, you can call it: |
@vzaidman, @ljosberinn thanks. |
I'm using this component in a
create-react-app
app:Using also
why-did-you-render
(https://github.com/welldone-software/why-did-you-render) I got this warning:So I made a custom
PureComponent
like this:FIRST QUESTION: Is this performances-correct?
I'm using it like this:
SECOND QUESTION: Can I avoid this component at all using React.memo (or something else) differently?
Now eslint is complaining about:
THIRD QUESTION: How can I fix this?
The text was updated successfully, but these errors were encountered: