March 2019
Intermediate to advanced
534 pages
14h 52m
English
Here's some code that captures all of the pieces required to put together a radio button group into a single component:
import React, { useState } from 'react';import Radio from '@material-ui/core/Radio';import { default as MaterialRadioGroup } from '@material-ui/core/RadioGroup';import FormControlLabel from '@material-ui/core/FormControlLabel';import FormControl from '@material-ui/core/FormControl';import FormLabel from '@material-ui/core/FormLabel';const options = [ { label: 'First', value: 'first' }, { label: 'Second', value: 'second' }, { label: 'Third', value: 'third' }];const RadioGroup = ({ value, options, name, label, onChange }) => ( <FormControl component="fieldset"> <FormLabel component="legend">{label}</FormLabel> ...Read now
Unlock full access