[Vuejs]-Clearing input field when using Vue with Vuex

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

Leave a comment