Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Redux StateManagement #11

Open
pepoospina opened this issue Jan 27, 2021 · 0 comments
Open

Add Redux StateManagement #11

pepoospina opened this issue Jan 27, 2021 · 0 comments
Labels

Comments

@pepoospina
Copy link
Contributor

pepoospina commented Jan 27, 2021

Add redux state management. Once done, we should be able to create a component like this

export class MyComponentWithEveesAndStore extends stateConnect(LitElement)) {
  stateChanged(state) {...}
  goToSection(id: string) {
      access to this.evees.client
      access to this.store.dispatch(goToSection(id));
  }
}

For components that render one evee, we should also be able to do like this:

  export class MyComponentWithEveesAndStore extends AppEveesBaseElement<Section>)) {
  stateChanged(state) {...}
  dataUpdated() {...}
  goToSection(id: string) {
      access to this.evees.client
      access to this.store.dispatch(goToSection(id));
  }
}

The AppEveesBaseElement class should extend the EveesBaseElement to handle the client state, and include the app redux store too.

Note that our app state will be split in two: the redux state for app-specific state like the selected page, the status of some components, a snack bar, etc. But all the content-related state will be in the Client (this.evees.client...) service.

For this, we can create another HTML container element (similar to evees-container) that will send the store to the components using DOM events. The stateConnect() mixin will take care of injecting the store and the evees service and will replace and include the eveesConnect() mixin.

@pepoospina pepoospina changed the title StateManagement mixin Add Redux StateManagement Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant