React Make RadioButtons -- Introduces Properties
Extend the react Component Class to make a dynamic radio button with label.
- We want to re-use the class code so we make the value and text based on component
properties that we can change.
- The properties will be the value, the text, the name and the id.
- In the definition of the extended class the properties are referred to as
{this.props.groupName}
- When invoking the component the properties are set to specific values as
groupName="size"
- Because in JSX/Babel we are mixing HTML and JavaScript we have to be
careful of keywords used by each. Thus we replace the HTML
for
,
used to make the label and radio input work as a unit, with htmlFor
Sizes