Closed jink-e closed 4 years ago
Hi,
I assume that if you run bit show
on the component you'll see that both React and Styled-components are set as dependencies
. When setting components for reusability you should set some dependencies to be peerDependencies
instead. In React, these should be react
and react-dom
. Additionally, styled-components needs to be a singleton in the project, so in your case, you'd want to set it as a peer as well.
You can read more about it in Bit's guidelines for React. You can also use overrides to configure it for components.
Thank you so much! @itaymendel This can be solved by adding peerDependencies
// components/test-button/package.json
"peerDependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
Appreciate agin :)
Describe the bug
react component
Steps to Reproduce
const Wrapper = styled.div
color: red; text-align: center; vertical-align: middle; line-height: 50px; width: 100px; border: 1px solid blue; border-radius: 10px;
;const TestButton = props => (
);
export default TestButton;
Expected Behavior
no invalid hook error appear no need of manually removing react in
components/test-button/node_modules
Screenshots, exceptions and logs
If applicable, add screenshots, exceptions, and logs to help explain your problem.
Specifications
Additional context
Add any other context about the problem here.