Skip to content

Instantly share code, notes, and snippets.

@yarastqt
Created February 16, 2022 16:33
Show Gist options
  • Save yarastqt/ad584544adedbd8d1376a7b5d569b569 to your computer and use it in GitHub Desktop.
Save yarastqt/ad584544adedbd8d1376a7b5d569b569 to your computer and use it in GitHub Desktop.
class SharedStore {
hydrate(ctx) {
this.data = ctx.data
}
}
const $sharedStore = new SharedStore()
class FeatureStore {
data = $sharedStore.data
hydrate(ctx) {
$sharedStore.hydrate(ctx)
}
}
@yarastqt
Copy link
Author

yarastqt commented Feb 16, 2022

Instead this approach we can use separate store into view:

function Feature() {
  const sharedStore = useStore($sharedStore)
  const featureStore = useStore($FeatureStore)
}

Because I guess derived store is not better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment