I use styled components mainly on the library of components I'm making and my personal approach is:
- MyComponent |- index.js |- MyComponentBase.js |- MyComponent.js
index.js
MyComponent.js
MyComponentBase.js
The downside of working like this is when you implement some ReactDocs the proptypes on the MyComponent are not visible by default.
MyComponent
I hope it helps.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I use styled components mainly on the library of components I'm making and my personal approach is:
index.js
only imports and exportsMyComponent.js
.MyComponent.js
importsMyComponentBase.js
and creates a styled version, this file handles all de "CSS" and props related to the CSS.MyComponentBase.js
it's a regular React component.The downside of working like this is when you implement some ReactDocs the proptypes on the
MyComponent
are not visible by default.I hope it helps.