I have a stateless functional component in React 0.14 that worked in React 0.13, but now returns the following error:
No
rendermethod found on the returned component instance: you may have forgotten to definerender, returned null/false from a stateless component, or tried to render an element whose type is a function that isn't a React component.
This is my component:
function ToggleDisplay(props) {
//should render a <noscript> per React's implementation
if(props.if === false) {
// return <noscript></noscript>; //do I have to do this manually now?
return null;
}
let style = {};
if(shouldHide(props)) {
style.display = 'none';
}
return (
<span style={style} {...props} />
);
}
Do I have to manually return a <noscript> now? Is there another way to return null in stateless component?