React useEffect infinite loop
问题 I was experimenting with React a little and wanted to retrieve a json file I had on S3 bucket. I'm using the next code import React, { useState, useEffect } from "react"; import { Storage } from "aws-amplify"; export default function Gallery(props){ const [picList, setPicList] = useState([]); useEffect(() => { async function onLoad() { try{ const picUrl = await Storage.get('list.json'); const picr = await fetch(picUrl); const picjs = await picr.json(); setPicList(picjs); console.log(picList);