DEV Community

klappleseed
klappleseed

Posted on

How does Vue.js, Angular, or Ember do data store?

How does Vue.js, Angular, or Ember do data store? I found React's Redux a bit complicated / messy and have a lot of boilerplates, usually with a lot of selectors after selectors and createSelector(), and tons of reducers.

I know I don't have to use Redux with React, but most projects I have seen (and have to use at work) use Redux.

Top comments (2)

Collapse
 
nullvoxpopuli profile image
NullVoxPopuli • Edited

Ember has the library ember-data, which handles all relational data for you. It currently only works with REST-based apis ({json:api} being the best spec in REST for this), but it manages cache / requests / etc for you. No need to configure anything.

usage is this:

export default class MyComponent extends Component {
  @service store;

  async fetchUsers() {
    return await this.store.findAll('user');
  }
}
Enter fullscreen mode Exit fullscreen mode

and then later down the road when you want to read from the cache, you can this.store.peekAll('user') for synchronous access to the cache

More information here: guides.emberjs.com/release/models/

Collapse
 
dennisfrijlink profile image
Dennis Frijlink

I have a lot of experience working with Vue.js. For state management in Vue js you can use Vuex (vuex.vuejs.org/guide/).