import { useState, useEffect } from 'react' import './App.css' function App() { useEffect(() => {getSurvey()},[]); const [responses,setResponses] = useState([]); function getSurvey() { const url = window.location.href; if(url.indexOf('#') > 0) { let parts = url.split('#'); let id = parts[1]; fetch("http://localhost:8085/responses?survey="+id).then(response=>response.json()).then(response=>{setResponses(response);}); } } if(responses.length > 0) return (

Survey Responses

{responses.map(r => {return(); })}
) else return (

No data

No data to display

) } function Response({response}) { if(response.responses.length > 0) { return ( <>

{response.prompt}

) } else { return ( <>

{response.prompt}

) } } export default App