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

StoreProvider widget that can inject the store into the vdom tree #76

Closed
agubler opened this Issue Aug 21, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@agubler
Member

agubler commented Aug 21, 2018

Enhancement

Add a new module StoreProvider that can be used like any widget within the widget tree, and will inject a store into a renderer function so that state and processes can be passed as properties.

interface State {
	foo: string;
	bar: {
		baz: string;
	}
}

class MyApp extends WidgetBase {
	protected render() {
		return w(StoreProvider, { stateKey: 'state', (store: Store<State>) => {
			return v('div', [ store.get(store.path('foo')) ]);
		}})
	}
}

This will replace the existing StoreContainer in a major release after 4.0.0 and the migration guide and upgrade tool warn that usages of StoreContainer should be converted to use StoreProvider.

@agubler agubler changed the title from StoreProvider widget that can inject the store into the widget tree to StoreProvider widget that can inject the store into the vdom tree Aug 21, 2018

@agubler agubler closed this in #77 Aug 29, 2018

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