Path: blob/main/examples/how_to/custom/react/react_demo.js
2012 views
import confetti from "canvas-confetti";1import Button from '@mui/material/[email protected]&no-bundle';23function App(props) {4const [color, setColor] = props.state.color5const [text, setText ] = props.state.text6const [celebrate, setCelebrate] = props.state.celebrate78React.useEffect(() => confetti(), [celebrate])9const style = {color: color}10return (11<>12<h1 style={style}>{text}</h1>13{props.child}14<input15value={text}16onChange={e => setText(e.target.value)}17/>18<Button variant="contained">Hello world</Button>19<button onClick={() => confetti()}>Click me!</button>20</>21);22}2324export function render({ state, el, children, view }) {25return (26<App state={state} child={children.child}/>27)28}293031