kbrsh / moon

🌙 The minimal & fast library for functional user interfaces
https://moonjs.org
MIT License
6k stars 200 forks source link

Keyed Loops #236

Open kbrsh opened 6 years ago

kbrsh commented 6 years ago

Loops need an option to be keyed in order to reorder components and preserve state.

kbrsh commented 5 years ago

Closing because there is no local state in Moon v1.

ryansolid commented 4 years ago

The reason for a library to implement keyed loops is to preserve DOM state rather than library state.

kbrsh commented 4 years ago

Actually, Moon aimed to have mechanisms for storing DOM state directly within vnodes, moving the responsibility of maintaining DOM state to the developer (e.g. a focus prop). I realized that it wasn't exactly practical, so a keyed algorithm is back on the roadmap.