This is the recipe page component
const RecipePages = (props) => {
return (
<div>
< h5 className="page-header" > Steps</h5 >
<div className="page-content">
<ol>
{
str1 = props.props[0].steps.split('\n'),
str1.map((elem) => {
return (
<div>
<li>{elem}</li>
</div>
)
})
}
</ol>
</div>
</div >
)
};
This is where I am using ?? operator
{
(0 < items[0].steps.length < 8) ??
<div className="demoPage page">
<RecipePages props={items} initial={0} count={items[0].steps.length}></RecipePages>
</div>
}
I am getting the following error
Error: React.cloneElement(...): The argument must be a React element, but you passed null.
I am trying to print the recipe in a form of a book so I need to add new pages according to the recipe length, that's why I am using this approach.
(0 < items[0].steps.length < 8)doesn't do what we all wish it would -- check out: stackoverflow.com/questions/16655959/…