drcmda / drcmda/react-contextual

Subscriber component causes re-mount of children on prop changes

Open
#34 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
638
Forks
21
PR merge metrics
No merged PRs in 30d

Description

The subscriber HOC works fine, but the Component causes all children to re-mount on any prop changes.

![contextual](https://user-images.githubusercontent.com/31106469/45503019-cf649480-b742-11e8-8e9b-30fdd002ac3f.gif)

See demo here: https://codesandbox.io/s/4jr86n2w77

Typing into `Component` text box loses focus on each keypress (due to re-mount), whereas the HOC works fine.

I suspect this is due to creating a new react element on each prop change here: https://github.com/drcmda/react-contextual/blob/master/src/subscribe.js#L73

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.