choojs / choo

:steam_locomotive::train: - sturdy 4kb frontend framework
https://choo.io/
MIT License
6.78k stars 595 forks source link

Render cached components by id #672

Closed YerkoPalma closed 6 years ago

YerkoPalma commented 6 years ago

fix #670

goto-bus-stop commented 6 years ago

I think having to use the state.cache(Component, 'id') API everywhere is intentional. There are no guarantees for anything actually being in the cache, so state.cache('id').render() could start throwing if something was removed. Plus, the Component being written in the call means you can read the view code and know which component will be rendered, without having to grep for the ID to try to find where it was defined.

YerkoPalma commented 6 years ago

Oh I see, closing then.

Thanks for the response.