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.

Issues with "as" vs "is" props in V3

See original GitHub issue

I noticed that the docs recommend using as to change the underlying tag emitted. However, if I use as instead of is, then all of the styled-system helpers are removed, and the values are passed directly to the DOM.

i.e. this works

const Code = props => 
  <Text
    is='code'
    fontFamily='mono'
  />

However, if we swap is with as, fontFamily now gets passed as font-family as an attribute on the tag directly. I get

  <code font-family="mono" class="random-gen-class-name"></code>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:23 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mrfeltoncommented, Apr 4, 2019

@jxnblk yeah, understood.

For now, we just keep our dependencies pinned to the following versions:

rebass@3.0.0-9
babel-plugin-styled-components@1.8.0

These do not suffer from the issue (rebass@3.0.0-9 uses it’s own css prop handling rather than relying on styled-components)

1reaction
mrfeltoncommented, Jun 12, 2019

https://www.styled-components.com/docs/api#css-prop

This is different from the old rebass css prop.

Old style (expects css object):

css={{
  'background-color': 'red',
  'border': '1px solid green';
}}

New style (allows you to write actual css):

css={`
  background-color: red;
  border: 1px solid green;
`}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Explain different ways that props are treated in v3 · Issue #1277
In v3 v-on was merged with props, for that to happen props started with on* are treated as events h(Comp, { onMyEvent...
Read more >
Types issue in Vue 3 Typescript based Project - Stack Overflow
Props are declared in separate Files. Please see Below attachments: Vue component : Error on v-for loop. Props are declared in, props.ts :....
Read more >
v-model breaking - Vue 3 Migration Guide
BREAKING: When used on custom components, v-model prop and event default names are changed: prop: value -> modelValue ; · BREAKING: v-bind 's...
Read more >
3 Anti-Patterns to avoid in Vue.js - Binarcode
However this can create couple of issues: We mutate the prop without letting the parent now about it; We might get unexpected behavior...
Read more >
Render Props - React
In this document, we'll discuss why render props are useful, and how to write your own. Use Render Props for Cross-Cutting Concerns. Components...
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