I have a React app in in which I have to make calls to an API. I created a dataService.js where I will create all the functions with the calls to my API.
In the component in which I need to retrieve the data, I simply try to console.log the data but I have a Promise {<pending>} instead of the result I need... What can I do to retrieve the data ?
My initial idea is to retrieve all the data I need using this dataService.js and setting the state of the component with the data. I guess it is possible but how ?
dataService.js:
export const dataService = {dataValue};
function dataValue() {
    return axios.get('url/to/api')
        .then(response => {
            console.log(response.data.soc) //this works well !
            let soc = response.data.soc
            return soc;
        });
}
myComponent.js:
class myComponent extends Component {
    render() {
        let test = dataService/dataValue(); // I imported the dataService !
        console.log(test);
        return (<div></div>);
    }
}