React wrapper not working with components with contexts
See original GitHub issueRepro
Open Codesandbox: https://codesandbox.io/s/9yr3rmrkny
Current Behaviour
Tippy tooltip is rendered outside of the react dom tree. That makes it impossible for elements with context (eg: Link from react-router) to work properly
Expected behavior
useContext flag renders tippy instance inside of React’s context DOM.
react-tippy uses this flag and works great, but that library hasn’t been updated in ages and currently has some positioning bugs .
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Context - React
Context. Context provides a way to pass data through the component tree without having to pass props down manually at every level.
Read more >wrap the root component in a <Provider>,or pass a custom ...
Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to...
Read more >Include Context in ReactExample and Wrapper #1639 - GitHub
I attempted a themed wrapper using rsg-components/Context, ... The key part--what isn't working but should-- is in ThemedWrapper.jsx :.
Read more >The Problem with React's Context API | Strings and Things
All you have to do is wrap your components in a Context.Provider and then call useContext(Context) inside that component to access your state ......
Read more >How to use React Context effectively - Kent C. Dodds
The React docs suggest that providing a default value "can be helpful in testing components in isolation without wrapping them.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The gist has been updated to use
ReactDOM.findDOMNode()to work with components as children (not just elements). Only the content needs a ref.I’m pretty sure it now:
findDOMNode())Please see the official React component for v3. v3 is much better because any prop can be updated (ones that affect the appearance of the tooltip) unlike v2 which only updates the tooltip content, due to the new
set()method.I think I got it working! 🎉 Just use refs:
Please see: https://gist.github.com/atomiks/25ba93a551fc1e8a1ef18aa7669c6699