Docz: How to set up playground for controlled components?

Created on 6 Oct 2018  路  1Comment  路  Source: doczjs/docz

I apologize if I'm missing something obvious here. Don't taze me, bro.

I need to set up a playground to demo a controlled completely-parent-component. Without state and updates being triggered from a parent, the component will not be interactive at all.

Can anybody point me in the right direction to make this work?

question

Most helpful comment

Well, I was successful in getting this to work by wrapping the actual demo JSX in a <Component> from react-component-component.

screen shot 2018-10-08 at 9 30 41 pm

I suppose, alternatively, since the implementation details of the moving parts above the actual demo'd component don't matter so much, so creating a <DemoStateContainer> kind of component in a separate file and importing it for use in the demo would work just fine, hide the implementation details, and allow the demo to be interactive.

>All comments

Well, I was successful in getting this to work by wrapping the actual demo JSX in a <Component> from react-component-component.

screen shot 2018-10-08 at 9 30 41 pm

I suppose, alternatively, since the implementation details of the moving parts above the actual demo'd component don't matter so much, so creating a <DemoStateContainer> kind of component in a separate file and importing it for use in the demo would work just fine, hide the implementation details, and allow the demo to be interactive.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hayk94 picture hayk94  路  3Comments

fenbka picture fenbka  路  3Comments

bichotll picture bichotll  路  3Comments

mariusespejo picture mariusespejo  路  3Comments

ssylvia picture ssylvia  路  3Comments