April 2020
Intermediate to advanced
716 pages
18h 55m
English
A signed-in user will see a toggle in the Edit Profile view, allowing them to either activate or deactivate the seller feature. We will update the EditProfile component to add a Material-UI Switch component in FormControlLabel, as shown in the following code:
mern-marketplace/client/user/EditProfile.js:
<Typography variant="subtitle1" className={classes.subheading}> Seller Account</Typography><FormControlLabel control={<Switch checked={values.seller} onChange={handleCheck} />} label={values.seller? 'Active' : 'Inactive'}/>
Any changes to the switch will be set to the value of the seller in state by calling the handleCheck method. The handleCheck method is implemented as shown here:
mern-marketplace/client/user/EditProfile.js ...
Read now
Unlock full access