March 2019
Intermediate to advanced
534 pages
14h 52m
English
Let's say that you have an API function that fetches content based on an index value. For example, if the first panel is expanded, the index value will be 0. You need to be able to call this function when the panel is expanded, supplying the corresponding index value. Here's what the code looks like:
import React, { useState, Fragment } from 'react';import ExpansionPanel from '@material-ui/core/ExpansionPanel';import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';import Typography from '@material-ui/core/Typography';import ExpandMoreIcon from '@material-ui/icons/ExpandMore';const fetchPanelContent = index => new Promise(resolve ...Read now
Unlock full access