Skip to content

Conversation

@jpavon
Copy link
Contributor

@jpavon jpavon commented Jun 4, 2018

Related issue #5

@tsiq-swyx tsiq-swyx merged commit 326f63c into typescript-cheatsheets:master Jun 4, 2018
@tsiq-swyx
Copy link
Contributor

this is great! thank you! I might have to reorganize a bit, i'll do this after merge

@jpavon jpavon deleted the patch/context branch June 4, 2018 15:11
@slorber
Copy link
Collaborator

slorber commented Nov 12, 2018

note this implementation is not recommended for perf reasons, as creating a new store object on every render means that re-rendering the provider will make all the consumers re-render.

public render() { const store: ProviderStore = { state: this.state, update: this.update } return ( <Context.Provider value={store}> {this.props.children} </Context.Provider> ) }

This is one reason I built https://github.com/slorber/react-updatable-context, which is somehow an inferior version of Unstated

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

Labels

None yet

3 participants