Skip to content
Discussion options

You must be logged in to vote

The items in the map need to be stateful. E.g.

const handleAddCategory = () => {
	counter += 1
	const item = $state({
		items: []
	});
	map.set(counter, item)
}

This wraps the object in a state proxy that provides reactivity signals. This only works for plain objects and arrays. Primitives and class instances can not be made reactive this way. For classes the individual properties need to use $state.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@beeb
Comment options

Answer selected by beeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants