import React, { useState, useEffect } from 'react'; import axios from 'axios'; const App = () => { const [data, setData] = useState({ hits: [] }); useEffect(() => { const fetchData = async () => { const result = await axios( 'https://discord.com/api/guilds/723409709306216498/widget.json', ); setData(result.data); }; fetchData(); }, []); const str = JSON.stringify(data) let status = 0 if (str.indexOf("status") !== -1){ status = data.members && data.members[0].status; } return ( <>
{ (() => { if (status == 0) { return
}else{ if (status == "online"){ return
} else if (status == "idle"){ return
} else { return
} } })() }
) } export default App;