Not able to compose components by inserting one Primitive inside another #1491
-
I am trying to use a Dialog component inside a Dropdown component. I have placed the trigger for the Dialog inside an item of the Dropdown menu, and I get the error "React.children.only expected to receive a single React element child". Can I not use one primitive inside another? Code:
` Dialog Component
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I was returning the Dialog out of another Functional Component. Decided to put the code on directly inside the Dropdown menu. I don't get that error anymore but now the Dialog isn't being triggered. |
Beta Was this translation helpful? Give feedback.
-
Hey @dannyboi07, here's an example of |
Beta Was this translation helpful? Give feedback.
-
I got it working. If you want to open just one Dialog box to open from your Dropdown then Ben's link works. |
Beta Was this translation helpful? Give feedback.
I got it working. If you want to open just one Dialog box to open from your Dropdown then Ben's link works.
I wanted multiple ones to open, and this solution works for me https://codesandbox.io/s/magical-grass-j85kbz?file=/src/App.js