function ArtikelPage() {
const [data, setData] = React.useState([]);
React.useEffect(() => {
(async () => {
const result = await getAllData('laporan');
setData(result);
console.log(data);
console.log(result);
})();
}, []);
why when i try to fill the state "data" by using setData(result) ,but when i console.log(data) the variable "data" array is empty , but when i console.log(result) the array contains