Mowzer
0
Q:

get data from api in javascript

const GetData = [];
  useEffect(() => {
    fetch(API_URL)
      .then((res) => res.json())
      .then((data) => {
        GetModesData.push(...data);
        setDataState(GetData.map((d) => d.modeName));
      });
  }, []);
1
const GetData = [];
  useEffect(() => {
    fetch(API_URL)
      .then((res) => res.json())
      .then((data) => {
        GetModesData.push(...data);
        setDataState(GetData.map((d) => d.modeName));
      });
  }, []);
0

New to Communities?

Join the community