简体   繁体   中英

Multiple ngrx store instances in one application

Is it possible to create an instance store for each component instance - as is the case with services by declaring the service in the providers array in the component decorator?

Yes it's possible, Managing different slices of the same NgRx state .

You will have to create an instance per component:

{
  "counters": {
    "31cd7f19-559e-4d77-8899-97797368b8c4": {
      "count": -1
    },
    "ca6184a4-10cf-473c-b1f6-6bb73ab20679": {
      "count": 4
    },
    "1caf0bc3-1414-4221-ae1d-a94f99ced451": {
      "count": 0
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM