I am trying to create a component that loops from 0 to the value entered as a prop.
if (props.number !== "" && props.toPow !== "") {
for (let i = 0; i < props.toPow; i++) {
return (
<div>
<span>
{props.number} ^ {i} = {Math.pow(props.number, i)}
</span>
</div>
);
}
} else {
return <h3>Please fill in all fields</h3>;
}
However, React is showing an error:
Error: Component(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.