How to toggle a view based on a state in vuex?

Viewed 1709

I have a button <Button> Log me in! </Button>, and I would like to change its css class based on the state of my current vuex app. (state.user is not null)

What is the proper way to write this code?

I can create a field in the state that is the classname of this view and change that accordingly in actions/mutations. But are there better places that I should be placing this logic? As this field is completely component dependent, I don't think it should "leak" out to the global state.

2 Answers
Related