skip to Main Content

The part of the code that is causing the problem has the following syntax:

import axios from "axios";

const handleLogin = () => {
        const user = {
            email:email,
            password:password,
        };

        axios.post("http://localhost:8082/login", user).then((response) =>{
            const token = response.data.token;
            AsyncStorage.setItem("authToken",token);
            router.replace("/(tabs)/home")
        }) 

    }

Here are the errors presented both in cmd and in the application:

enter image description here
enter image description here

After researching what could be due to the syntax, but even after changing it, there was no solution to the problem. Any idea how I resolve this?

2

Answers


  1. Chosen as BEST ANSWER

    the import was done correctly and after consulting package.json I saw that axios is downloaded in version 1.6.7 Do you know what other reason there could be for him not identifying the axios?


  2. The error message you’re encountering, "property axios does not exist," it seems that the axios module is not properly imported into your file or it is not recognized in your environment.

    Check if it is properly installed, you can check in pacakge.json

    npm install axios
    import axios from 'axios';
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search