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.

I get styled-components warning, if using react-table-library

See original GitHub issue

Hey,

I have an app (create-react-app) with the styled-components-dependency. Now I added react-table-library and get following warning:

It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.

See https://s-c.sh/2BAXzed for more info.

I see, we have babel-plugin-styled-components at package.json of react-table-library, but I can’t figure out why the warning happened, so far.

Do you have an idea? Should we mark styled-components as external in this lib? Do you know a workaround for now (maybe resolutions)?

Thx

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rwieruchcommented, Jun 19, 2021

Let’s keep the babel plugin for now. I have only SC before and switched to the babel plugin under the assumption that SC would go away this way. But like you said, the plugin uses SC under the hood.

0reactions
wuarmincommented, Jun 19, 2021

The babel plugin could be removed by using default SC styling. I can’t think of a better alternative (in best case no dep) to SC either. With emotion it would be the same, wouldn’t it?

What do you think of just using SASS? Library users could apply custom themes, by using table-library’s class names.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Can't resolve 'styled-component' [closed]
But when I use it in component, I am getting following error. Failed to compile. ./src/Components/Lightbox/styledLightbox.js. Module not found:.
Read more >
How To Use Styled-Components In React - Smashing Magazine
Styled components are independent of each other, and you do not have to worry about their names because the library handles that for...
Read more >
How to use styled components with Material UI in a React app
Styled -components is another great library used to style React components. We do so by defining React “styled” components without CSS classes.
Read more >
Basics - styled-components
If the component is unused (which tooling can detect) and gets deleted, all its styles get deleted with it. Simple dynamic styling: adapting...
Read more >
React 18: having Invalid hook call problem with rendering app ...
I have a problem with rendering app after migrating to 18 version const root = ReactDOM.createRoot(document.getElementById('root')); const ...
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