question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[material-ui-icons] reduce code duplication?

See original GitHub issue

I’ve noticed, that every file in src directory implements props forwarding, sets muiName, checks global.__MUI_SvgIcon__ and so on, which leads to code duplication in bundle.

Generally, the unique content of every icon is it’s path. All other stuff is common for every icon.

So it should be possible to create single HOC, which does all common stuff. Then use it in every file, providing path and export the result.

What do you think?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cherniavskiicommented, Apr 3, 2018

BTW, looks like I wasn’t talking about HOC in classical term, it’s indeed more like a factory. Anyway, I’ll submit a PR soon, please take a look. No pressure 😉

1reaction
cherniavskiicommented, Apr 3, 2018

Ok, I’ll submit a PR then 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[material-ui-icons] reduce code duplication? #10900 - GitHub
I've noticed, that every file in src directory implements props forwarding, sets muiName , checks global.__MUI_SvgIcon__ and so on, ...
Read more >
Minimizing bundle size - Material UI - MUI
DX : This syntax reduces the duplication of code, requiring only a single import for multiple modules. Overall, the code is easier to...
Read more >
How to increase material-ui icons? - Stack Overflow
Try adding the label style of the button like below import ArrowUp from 'material-ui-icons/KeyboardArrowUp' <Button fab color="primary" ...
Read more >
@material-ui/icons | Yarn - Package Manager
This package provides the Google Material icons packaged as a set of React components. Installation. Install the package in your project directory with:...
Read more >
How to Reduce Code Duplication? | React.js | Devtools Tech
In this video we are going to discuss a particular case related to reducing code duplication in our React Apps by abstracting out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found