i tried to pass it to a function but the result remains the same
You can not render a component in
You should pass a string to
For example ✅:
window.alert("Hello! I am an alert box!!");
And the below is the wrong way ❌:
If you want to render the
<Cart /> in a modal you should build it yourself or find another solution.
The reason you get [object object] is that React components are all objects with some properties. And you can’t pass an object to alert methods.
Although you can stringify the object using