mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-07 20:44:05 +09:00
4e9986d6e36d9fb4866417d8938f188a82ac930f
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
Languages
TypeScript
98.9%
PLpgSQL
0.5%
CSS
0.3%
Shell
0.2%
JavaScript
0.1%
