1

On the user's sidebar there is a number of new unseen notifications. This number is generated by a function which counts all new notifications with the flag viewed: false from API.

My question is: what will be good practice if I want to place this function in one of the lifecycle hooks inside the component of the sidebar? updated() or computed?

Olga B
  • 513
  • 2
  • 11
  • 34

1 Answers1

1

You should be using computed if you - as it seems - want the component to change whenever the computed value changes.

sundeqvist
  • 171
  • 10