question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Popup: triggers that do not spread props do not work

See original GitHub issue

Steps

  1. Create a stateless component.
  2. Pass it to Popup as the trigger prop.

Expected Result

Get the popup when mousing over the trigger component.

Actual Result

Don’t get a popup when mousing over the trigger component.

Version

0.64.2 (master)

Testcase

http://codepen.io/anon/pen/VPpZQL

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
levithomasoncommented, Jan 20, 2017

It is best practice to consume handled props and pass the rest along, which is what is required for the trigger to work. Here is a fork that shows the necessary changes:

http://codepen.io/levithomason/pen/QdpvRm

-const TriggerComponent = () => (
-  <span>Mouseover fails</span>
+const TriggerComponent = (props) => (
+  <span {...props}>Mouseover fails</span>
);

That said, this actually confused me at first as well. So, it is at the least unintuitive. I believe we can make this work for custom components that do not consume their props and pass the rest. I’ll leave this issue open for that work.

0reactions
layershiftercommented, Jul 27, 2020

@neutraali can you please create a new issue with a repro if you faced an issue that can’t be fixed with this comment (https://github.com/Semantic-Org/Semantic-UI-React/issues/1187#issuecomment-273988903)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing props to reactjs-popup component - Stack Overflow
For the Modal I use reactjs-popup, eveything works fine only the title and image do not appear. modal image. This is where I...
Read more >
Why I stopped spreading props on React Components
Explicit is better than implicit.​​ In conclusion, while spreading props is a powerful pattern we must be aware of its drawbacks and conscious ......
Read more >
Build a POPUP component in React JS - YouTube
Learn how to build a popup component for React JS by using React Hooks and functional components. We build a timed popup that...
Read more >
Controlling tooltips & pop-up menus with components in React
Also, it is required to pass the open() function to <Select> component as a prop so that when the selected element is clicked,...
Read more >
material-ui-popup-state - npm
The id for the popup component. It will be passed to the child props so that the trigger component may declare the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found