I think you confuse props and children. When you do:
<div className="foo" {} >
You are trying to use the built-in JSX expression, as if you were passing the details inside an open tag, this is NOT allowed. When you have an element, the opening tag can only contain deconstructed objects or prop=value values, so the reason why it expects ... is to deconstruct the object with details and values, for example:
const props = { className: "foo" } <div {...props}>
You cannot comment inside a tag because the tag does not allow JSX inline expressions. JSX expressions are only allowed as children:
{} <div className="foo" >
In this example, the expression is not inside the open tag of the element and is allowed.
Li357 source share