gaearon / react-deep-force-update

Force-updates React component tree recursively

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update only elements that subscribe to given contextType

wmertens opened this issue · comments

I use this to update components that use context to get translation strings after the language was switched.

I know this uses internal APIs, but using this is much nicer than either constantly managing 100+ listeners or force-rerendering the app through a key on the root element.

It would be even nicer if it would only update components that use the context in the first place. Would that be difficult to do? Would you accept a PR that does this?

Exact use case

Fixed by #6

Fixed by #6

@neoziro wouldn't it be nicer to provide a reference implementation of the shouldUpdate function for contextName-only updates?

commented

I was about to write an implementation but then realized there is a problem with #6. I filed #8 for it.