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.

Think about non-JSX users

See original GitHub issue

I don’t use JSX, but libraries like glamor are still a pleasure to use:

dom.div(
  { ...style({ border: "1px solid black" }) },
  children
)

The problem with styled-components is that is forces you to always create new components. So now I have to do something like this:

const Title = React.createFactory(styled.div`border: 1px solid black`);
Title({}, children);

Obviously not ideal. I don’t know if you want to care about this or not, but it’s definitely a blocker for me to use this library.

An option would be to re-export all of the tags, and have them automatically wrap the result in a createFactory. So I would import styled-components/wrapped or something instead, and I wouldn’t have to use createFactory.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mxstbrcommented, Jul 1, 2017

Now that @jlongster made prettier to help him write JSX for styled-components and nobody else has asked for this use case I’ll close this issue!

0reactions
geelencommented, Oct 18, 2016

Why would calling React.createFactory be a bad thing if it was hidden inside the library? @jlongster maybe you could weigh in here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

is it possible to mix react jsx with non jsx components?
So the question I have right now is if I have a parent component that is JSX but I have the need to...
Read more >
Build A Header Component | React Fundamentals
Think of Components as the elements of user interfaces. ... In the Non-JSX version of the code, it's hard to tell what the...
Read more >
React's JSX Doesn't Violate Separation of Concerns
If you see a permanent slowdown from designer productivity loss, you might have a valid reason to consider a non-JSX solution.
Read more >
Thinking in React
Since you're often displaying a JSON data model to a user, you'll find that if your model was built correctly, your UI (and...
Read more >
How to Check if a User is Logged In with React - YouTube
This React JS tutorial shows how to check to see if a user is logged in each time they access the application. We...
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