mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 22:14:29 +09:00
Ref https://github.com/webstudio-is/webstudio/issues/2532 Collections will introduce nested scope within same component and some expressions at component scope will not be able to access collection item. For example ```ts const PageComponent = () => { let [value, set$value] = useState('') let show = value === 'error' let arialabel = item + ' label' return <Form> <ErrorMessage data-ws-show={show}></ErrorMessage> {list.map(item => <Button aria-label={arialabel}></Button> )} </Form> } ``` So the easiest way to workaround it without complicated scope selecting is just inline all expressions into props. ```ts const PageComponent = () => { let [value, set$value] = useState('') return <Form> <ErrorMessage data-ws-show={value === 'error'}></ErrorMessage> {list.map(item => <Button aria-label={item + ' label'}></Button> )} </Form> } ``` ## Steps for reproduction 1. Create `Form` 2. Try to change `state` prop
Webstudio SDK
Webstudio SDK is a TypeScript API that lets you use your Webstudio site or some components in your custom codebase or just render a complete Remix Document. It is currently under development, but feel free to play with the the current landing site