dynamic update component in playground?
See original GitHub issueIs it possible to dynamic update a component in Playground?
Description I would like to have a working example in the Playground. In my case I have a toggle component and I want to change the status of the selection when the user clicks the component
name: UIToggle
menu: Components
import { Playground, PropsTable } from 'docz'
import UIToggle from './index.js'
let isToggled = true;
const _onToggleStateChange = () => {
console.log(isToggled);
isToggled = !isToggled;
}
# UIToggle
Hello, I'm still a mdx file, but now I have a button component!
<PropsTable of={UIToggle} />
<Playground>
<UIToggle isToggled={isToggled} onToggle={ _onToggleStateChange } ></UIToggle>
</Playground>
This is my code. The variable isToggled is updated when the user clicks, but the components don’t receive any update.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
dynamic update component in playground? #223 - GitHub
Is it possible to dynamic update a component in Playground? Description I would like to have a working example in the Playground.
Read more >Playground Dynamic Component - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >Dynamic component creation in Lightning Web Components
The usual Web Components can be dynamically created through standard DOM APIs like document.createElement('c-my-cmp') or element.appendChild( ...
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 >Surface.Components.Dynamic.Component — surface v0.9.1
A built-in component that allows users to inject dynamic components into a Surface template.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I used react-component-component to create local state on the page and update it.
Example
Code
So in your case it would be :
Hope that helps !
This would help being documented. I searched for quite some time before getting here.