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.

Pattern for excluding props

See original GitHub issue

Do 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:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bebrawcommented, Oct 16, 2018

For React warning, React doesn’t warn anymore in 16 I think?

I’m running React 16 and it gives warnings.

It’s the same pattern as for SC then. 👍

0reactions
satya164commented, Jan 6, 2019

@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?

Read more comments on GitHub >

github_iconTop 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 >

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