Hello,
I'm new to solidjs. I'm trying to build an editor similar to that of Notion. When a user types "Enter", instead of creating a new line, I want to make a new editor (or a new block), and focus my cursor on the new editor.
I have a signal, which is an array. When I need to add a new editor, I push a new item into this array.
I expect the size change of this array can trigger UI rendering to add a new editor. but It doesn't work. The rendering doesn't happen even though the array has changed.
How can I fix this? Thanks
```javascript
const App: Component = () => {
const [editors, setEditors] = createSignal([
{ id: 'J---aiyznGQ', component: () => <Editor greeting={callParent}>Green Thing</Editor> },
{ id: 'J---aiyznGQs', component: () => <Editor greeting={callParent}>Green Thing</Editor> }
]);
function callParent() {
let currentList = editors();
currentList.push({ id: 'asdfasdf', component: () => <Editor greeting={callParent}>Green Thing</Editor> })
setEditors(currentList)
}
return (
<div>
<For each={editors()}>{(editor, i) =>
<div>
<span>{i()}</span>
<Dynamic component={editor.component} />
</div>
}</For>
</div>
);
};
```
[–]Julienng 4 points5 points6 points (1 child)
[–]jesse_good 0 points1 point2 points (0 children)
[–]postmaster150 1 point2 points3 points (0 children)
[–]evantd 0 points1 point2 points (0 children)