No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Difference between this.$store.state.search.query and this.$store.getters['search/getQuery']

    Help
    2
    2
    523
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      steve last edited by

      I understand that state is a set value and getters are/can be condition on the state value.

      Is that the only reason to choose between dot notation and a getter? Are there any other benefits or best practices in using one over the other?

      1 Reply Last reply Reply Quote 0
      • Z
        Zyme last edited by

        I looked into this issue recently and the conclusion I came to was this:

        Both return the same value if you are just accessing raw data. But a getter can manipulate the data before passing it along.

        If you are accessing the state directly throughout your app on many places, and you want to manipulate the data, for example change the number formatting or whatever. It wil become a pain to change it on all places.

        If you used a getter you only change this in one place.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post