I'm new to react-native. I'm trying to make a login component and it throws undefined as error.
const [name, setName] = useState(""); const [password, setPassword] = useState(""); const pressHandler = () => { navigation.navigate("Register"); }; const login = () => { const { nombre } = this.name; const { contraseña } = this.password; fetch("http://http://192.168.0.20/dbReact.php", { method: "POST", Headers: { Accept: "aplication/json","Content-Type": "application/json", }, body: JSON.stringify({ nombre: nombre, password: contraseña, }), }) .then((response) => response.json()) .then((responsejson) => { alert(responsejson); AsyncStorage.setItem("token", "86"); }); };