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.

How to render complex components in Playground

See original GitHub issue

Question

Hello, I would like to pass some variables to my components and use it inside <Playground> element as in the sample from https://github.com/pedronauck/docz/blob/master/examples/basic/src/components/Alert.mdx#L37

So in my case I have:

<Playground>
{() => {
     const subprojects = []
     return <Project label="SomeLabel" projects="{subprojects}" />
  }}
</Playground>

But this just renders as: screen shot 2018-07-23 at 09 46 26

These are my devDepedencies:

"docz": "^0.5.8",
"docz-plugin-css": "^0.5.7",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"react-test-renderer": "^16.4.1",
"typescript": "^2.9.2"

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mAAdhaTTahcommented, Jul 23, 2018

@angel-git This is a bug in your JSX:

return <Project label="SomeLabel" projects="{someVar}" />

// should be....
return <Project label="SomeLabel" projects={someVar} />

then "" around {someVar} makes it get passed in as a string, rather than the value.

0reactions
angel-gitcommented, Jul 23, 2018

ahhh how retarded I’m! thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bit has a playground to render your component | by Dotekitoo D ...
Bit has a playground to render your component ... The more complex your application, the harder it will be to refactor and switch...
Read more >
Advanced Playground Rendering Tools - GameTime
GameTime utilizes advanced rendering and animation software to provide a digital view of your new playground, Challenge Course or fitness park.
Read more >
11 React UI Component Playgrounds for 2019 - Bits and Pieces
Top component playgrounds to render, view and develop React UI components online. Hot reload, simple configurations and much more.
Read more >
component-playground: A component for rendering React ... - Reddit
component -playground: A component for rendering React components with editable source and live preview. r/reactjs - component-playground: A component for ...
Read more >
Built-in components - Docz
With the <Playground> component, you can render your component inside a live-editable ... documentation for your component can be difficult and error-prone, ...
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