Pattern for excluding props
See original GitHub issueDo you want to request a feature or report a bug?
Feature
What is the current behavior?
const Slide = styled.div`
page-break-after: always; /* Needed for print to work */
background-color: ${props => props.backgroundColor};
`;
leaks backgroundColor
into the DOM leading to a React warning.
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install
and yarn test
.
See above.
What is the expected behavior?
There should be a pattern for excluding props. As above, I use it only for logic. This might be solvable by either documenting the right way or by adding API. Even styled-components doesn’t solve this neatly yet.
Please provide your exact Babel configuration and mention your Linaria, Node, Yarn/npm version and operating system.
Linaria 1.0.0-alpha.8.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Section 2: Excluding Props - React TypeScript Cheatsheets
This is covered in passing in Section 1 but we focus on it here as it is such a common issue. HOCs often...
Read more >Transfer { ..this.props } but exclude certain ones - Stack Overflow
Is it possible to transfer props down to child component where { ..this.props } is used for cleaner easier syntax, however exclude certain ......
Read more >You Probably Don't Need Derived State – React Blog
Anti-pattern: Unconditionally copying props to state. A common misconception is that getDerivedStateFromProps and componentWillReceiveProps are ...
Read more >Transferring Props | React
It excludes every other property listed in the destructuring pattern. This is an experimental implementation of an ECMAScript proposal. var { x, y ......
Read more >3 Anti-Patterns to avoid in Vue.js - Binarcode
export default { name: "HelloWorld", props: { product: { type: Object, default: () => ({}) } }, methods: { addToCart() { if (this.product.stock...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m running React 16 and it gives warnings.
It’s the same pattern as for SC then. 👍
@thymikee I think doing it only in dev might produce inconsistent results. I’m not really sure. Does
styled-components
only do it in dev?