How to move table row to the top within a loop - React

32
June 26, 2022, at 6:30 PM

I have a loop which goes through an array (files) of objects (person). If the person works as a doctor or a vet I would like to display their row at the top of the table, if not, they should be displayed under the doctors and vets. I have a sample piece of code as to where i believe the code should be (See: <PLACE AT TOP OF TABLE>). I've been over and back with solutions and can't get anything solid. I have tried to add these persons to an array, add them to a new table component and insert the table here but no avail. Any tips would be greatly appreciated.

<tbody>
{props.files.map(person=> ( 
    <div>
        {(person.job === "doctor" || person.job === "vet") ? <PLACE AT TOP OF TABLE> :
            <tr>
                <td>{person.name}</td>
                <td>{person.age}</td>
                <td>{person.job}</td>
            </tr>
         }
    </div>
))}
</tbody>
Answer 1

You can use two different loops, the first loop, which searches for a doctor or a vet, occurs at the top of a table, then the second loop shows the others except the doctors and the vets

Rent Charter Buses Company
READ ALSO
Can we create an object in Java with out class like in js or python with random key and values

Can we create an object in Java with out class like in js or python with random key and values

Like in other programing languages - python or JS, when we create a rest api specifically post for the request body we attract some JSON Object

33
Jenkins pipeline library build using Java instead of Groovy

Jenkins pipeline library build using Java instead of Groovy

I would like to write my company Jenkins Pipeline Library using Java not Groovy, as groovy is slower than JavaI tried to find examples of such Java Jenkins library source code, but I found only Groovy

54
How to insert Repeated Record in BigQuery using java client library

How to insert Repeated Record in BigQuery using java client library

I am very new to BigQuery and need help to resolve below mentioned query

38