score:0

Accepted answer

try consol logging data.something like data.id or smthn and when you input the data maybe don't do data.data.attributes.name i think you can just do data.attributes.name since you already saved the first data in the state, if this doesn't work show us were you input the data

set data as a dependency in you useeffect to to make useeffect watch for changes in the state

const [data, setdata] = usestate([])

useeffect(() => {
    async function getdata() {
        var response = await axios.get(`api/admin/category/${category_id.id}`) #changed the link to what you used
        setdata(response.data)
    }
    getdata()
}, [])
console.log('data', data)

}


Related Query

More Query from same tag