0๐
I follow a rule of thumb to determine when something needs to be an application level state and when something needs to be at component level.
Any state that just affects the local view of a component and will never be required outside the view can be a local state. If you have opted for vuex
ideally you will avoid this also.
Everything else should go to the application level state. Then clearning the input after adding something is just a matter of setting this.text=""
in the addTodo
method.
๐คaks
- [Vuejs]-Navigating between named routes for same Path/URL
- [Vuejs]-Calling function outside vue component
Source:stackexchange.com