Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #9422
Closed
Open
Issue created Aug 05, 2020 by Administrator@rootContributor

Use memo: true flag with SVGR

Created by: vihanb

Is your proposal related to a problem?

My situation is, I have components that pass an SVG icon to another component, because the SVG instance always changes, I have a lot of unnecessary re-renders (e.g. <MyBigComponent icon={<MySvg />} />.

Describe the solution you'd like

SVGR has a memo option: https://react-svgr.com/docs/options/#memo which wraps all SVG components in React.memo. This would resolve the issue above. Additionally, I can't really think how memo would break existing projects so I believe it would be a helpful addition to create-react-app.

Describe alternatives you've considered

Alternative solutions that come to mind include something like useMemo(() => <MySvg />, []) but something about that feels wrong.

Assignee
Assign to
Time tracking