V
V
Vlad2019-12-16 12:02:58
JavaScript
Vlad, 2019-12-16 12:02:58

How to add span by condition?

Good afternoon!
Tell me please.
How to add a span to the table, as in the screenshot:
Now, this condition is implemented like this:

if (el === 'pool_1') {
    return (
        <div>
            <span>{el}</span>
            <FormattedMessage id="s3.migration">
                {(txt) => <a className="datastore__migration">{txt}</a>}
            </FormattedMessage>
        </div>
    )
}
return <span>{el}</span>

But the problem is that the lines in the first column can change. That is, you need to add span if the lines are the same!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Suntsev, 2019-12-16
@GreyCrew

It is difficult to understand what is required based on the question. But I can predict that it is required to show the element based on the availability of data for this element. In this case, you can do this: If you need to add a block below, then you can simply add this tag to the return block. Here you need to understand that after calling return, the execution of the render() function will stop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question