How to value format from api in react data grid?

I have my data grid in render and this.state.rows and this.state.columns
I want to change one of the columns’ value from another api.

This is where getting the value of column and it is working.

const DataFormatter = ({ value }) => { <span>{value}</span> });

I want to change the value of column from an id to the name.
Here is the data object look like:

const data = {
    value: 3242;
    name: somename;
}

My new DataFormatter logs the name but doesn’t render anything. It may return as an array is needed for object children. or object promise issue.

const DataFormatter = ({ value }) => { 

    const newValue = fetch("domain.name/{value}")
        .then(response=> response.json())
        .then(data => {
            console.log(data.name)
            return <span>data.name</span>
        });

});

Leave a Comment