I've been searching for a solution for my Problem, it seems actually pretty easy but it doesn't work :(. The problem is the following: I fetch data from my backend which is localhost/users. I get the data and i can console.log them. But it seems impossible for me to write it on a variable and export it. Here is my Code:
import axios from "axios";
function init() {
    let obj;
    axios('/users')
    .then(response => {
        obj = (response.data)
        console.log(obj)
        return obj
    })
    .catch(error => {
        console.log("error fetching")
        return null
    })
    
}
let obj = init()
export default obj
If i try to console.log the exported variable it just writes undefined, i guess it skips the response section. The returned Variable is undefined too
 
     
    