April 2020
Intermediate to advanced
716 pages
18h 55m
English
In order to become an educator in the MERN Classroom application, a signed-in user will need to update their profile. They will see a toggle in the EditProfile view, which will either activate or deactivate the educator feature. To implement this, first, we will update the EditProfile component in order to add a Material-UI Switch component in FormControlLabel, as shown in the following code.
mern-classroom/client/user/EditProfile.js:
<Typography variant="subtitle1" className={classes.subheading}> I am an Educator</Typography><FormControlLabel control={ <Switch classes={{ checked: classes.checked, bar: classes.bar, }} checked={values.educator} onChange={handleCheck} />} label={values.educator? 'Yes' : 'No'}