Can some go through my code and see what is the mistake I have done.
React and Axios code
import React, { useState, useEffect } from "react";
import { useParams, Outlet } from "react-router-dom";
import axios from "axios";
export default function Agent() {
const [Agent, setAgent] = React.useState();
const agentid = useParams();
React.useEffect(() => {
axios.get(`https://valorant-api.com/v1/agents/`).then((res) => {
setAgent(res.data);
});
}, []);
console.log(Agent);
return (
<div>
<h1>{agentid.agentid}</h1>
</div>
);
}
Can someone explain why there is an undefined?