I have a PopoverMenu component in which I would like to access and use the children prop. I have seen numerous posts similar to this but not similar enough to help my case.
children could be standard HTML or other React components.
Here is the PopoverMenu component:
export const PopoverMenu = (children) =>
{
const [visible, setVisible] = useState(true);
if (visible) {
return (
<ul ref={ node } className="popover-menu">
{ children }
</ul>
)
}
}
...and here is the component in use...
<PopoverMenu>
<PopoverMenuItem>
Edit
</PopoverMenuItem>
<PopoverMenuItem>
Delete
</PopoverMenuItem>
</PopoverMenu>
...or alternatively...
<PopoverMenu>
<li>
<a>Edit</a>
</li>
<li>
<a>Delete</a>
</li>
</PopoverMenu>
I have tried a variety of types for children but my IDE seems to complain about all of them. These include:
ReactNode
HTMLElement
ReactChildren
What type(s) would give me the desired result and why?