Data sync input between parent and children
I have the following scheme (cf picture):
- a route that get initial data
- data with items are sent to an island
- item of data are sent to a child island
Child islands have only input with no form nor validate button.
How to track and sync input change in children and reflect it to parent ?
3 Replies
routes/ToDoPage.tsx
islands/todos.tsx
islands/todoItem.tsx
Remove the
newItem
signal, it's useless and only complicates the code. The onChange
function can directly write into the target signal. There is no need to manually sync state with signals or think in terms of parent or child components. That's the old react way of thinking that's made redundant with signals.Thanks it works. I was a little bit out of date 😄 and I am upgrading with deno/fresh