I was wondering if doing this is considered as a bad practice in the react world?
const renderComparisonScore = (score) => {
return (
<div>
{score}
</div>
)
}
const Visualization = ({ score }) = {
return (
<div>
{renderComparisonScore(score)}
</div>
)
}
As you can see I'm calling the function renderComparisonScore
and passing the argument I know that the regular way of doing something like that is passing that as a prop like this:
const ComparisonScore = ({ score }) => {
return (
<div>
{score}
</div>
)
}
const Visualization = ({ score }) => {
return (
<div>
<ComparisonScore score={score} />
</div>
)
}
My question is, can I pass things in react as arguments instead of passing things using props, and if not why?