Take a simple component:
function MyComponent({ children }) { return children; }
It works:
ReactDOM.render(<MyComponent><span>Hello</span></MyComponent>, document.getElementById('stage'));
but this is not the case (I deleted <span/> ):
ReactDOM.render(<MyComponent>Hello</MyComponent>, document.getElementById('stage'));
because React is trying to call render on a line:
Uncaught TypeError: inst.render is not a function
On the other hand, this works great:
ReactDOM.render(<p>Hello</p>, document.getElementById('stage'));
How to make <MyComponent/> behave like <p/> ?
source share