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.

Hoist non react statics

See original GitHub issue

What will it allow you to do that you can’t do today?

Solve https://github.com/mui-org/material-ui/issues/9736 out of the box. We add a muiName static property to some of the Material-UI components. However, this static property is lost after wrapping the component with styled-components.

How will it make current work-arounds straightforward?

You are already solving the problem for withTheme: https://github.com/styled-components/styled-components/blob/1dfc7a64ff8ff3706424d68bbe021b8f973ff9db/src/hoc/withTheme.js#L6

What potential bugs and edge cases does it help to avoid?

It’s making the styled component higher-order component transparent to static properties.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
chengjianhuacommented, May 25, 2018

Sorry … I didn’t notice that. Super! 👍 @probablyup

1reaction
probablyupcommented, Feb 28, 2018

Hmm I thought we were already doing this. It’s considered a best practice for anything wrapping another component, so I think we should do it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hoist-non-react-statics - npm
Copies non-react specific statics from a child component to a parent component. Latest version: 3.3.2, last published: 3 years ago.
Read more >
mridgway/hoist-non-react-statics - GitHub
Copies non-react specific statics from a child component to a parent component. Similar to Object.assign , but with React static keywords prevented from...
Read more >
hoist-non-react-statics examples - CodeSandbox
Learn how to use hoist-non-react-statics by viewing and forking example apps that make use of hoist-non-react-statics on CodeSandbox.
Read more >
Why is VS Code importing from "hoist-non-react-statics ...
VS code intellisense is suggesting that I import from hoist-non-react-statics/node_modules/@types/react instead of from react when importing ...
Read more >
hoist-non-react-statics | Yarn - Package Manager
Copies non-react specific statics from a child component to a parent component. Similar to Object.assign , but with React static keywords blacklisted from...
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