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

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

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

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

agubler opened this issue Aug 21, 2018 · 0 comments
Labels
enhancement New feature or request next Issue/Pull Request for the next major version

Comments

@agubler
Copy link
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 StoreProvider widget that can inject the store into the widget tree StoreProvider widget that can inject the store into the vdom tree Aug 21, 2018
@agubler agubler added enhancement New feature or request next Issue/Pull Request for the next major version labels Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request next Issue/Pull Request for the next major version
Projects
None yet
Development

No branches or pull requests

1 participant