Is it possible to assign component to variable in React? I want something like this:
records[0] = {
return(
<Row key={'myValue'}>
{myValue}
</Row>
)
}
records[0] = {
return(
<Row key={'mySecondValue'}>
{mySecondValue}
</Row>
)
}
So then I can sort this array (records) based on other array and display.
returnthere is nonsensical. So are the curly-braces. And tworecords[0]. But that's not how you'd do it IRL, you'd have an array of data, each element rendered by a component, and when it's sorted, it would be re-rendered.