btroncone / ngrx-store-localstorage

Simple syncing between @ngrx store and local storage
MIT License
614 stars 119 forks source link

Angular 17 Standalone Components #265

Open SebasGonza opened 8 months ago

SebasGonza commented 8 months ago

How can i implement this library in angular 17 with standalone components?

gartu commented 6 months ago

You can do it by yourself like this :

const localStorageSyncReducer = (reducer: ActionReducer<unknown>): ActionReducer<unknown> => localStorageSync(config)(reducer);
const metaReducers: Array<MetaReducer<any, any>> = [localStorageSyncReducer];
const storeModule = StoreModule.forRoot(reducers, { metaReducers });

bootstrapApplication(AppComponent, {
      providers: [...(storeModule.providers ?? [])]
});