@material-ui/icons#CloudDownloadRounded TypeScript Examples

The following examples show how to use @material-ui/icons#CloudDownloadRounded. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.tsx    From ts-express-react with MIT License 6 votes vote down vote up
export default function App() {
  const [apiResponse, setApiResponse] = useState("");
  
  const onCallApi = async () => {
    try {
      const response = await fetch('/api', {
        method: "GET",
      });
      const text = await response.text();
      console.log(text);
      setApiResponse(text);
    } catch (error) {
      console.error(error);
      throw error;
    }
  }
  return (
    <div className="App">
      <Grid container spacing={6} justifyContent="center" direction="column">
        <Grid item> 
          {`Client App Name - ${ App_Name } `}
        </Grid>
        <Grid item> 
          <Fab variant="extended" color="primary" onClick={onCallApi}>
            <CloudDownloadRounded className="icon"/>
            Call API
          </Fab>
        </Grid>
        {apiResponse &&
          <Grid item> 
            {`Server Response - ${ apiResponse } `}
          </Grid>
        }
      </Grid>
    </div>
  );
}