我有两个组件,分别为 Select.JS 和 App.JS 。我要导入Select.JS
中的App.JS
中有一个特定元素。我想将具有className age
的元素导入到* Apps.Js **中,我该怎么做?
Select.JS
export default class SimpleSelect extends React.Component {
<FormControl fullWidth>
<InputLabel htmlFor="age-simple">Age</InputLabel>
<Select value={this.state.age} onChange={this.handleChange}
inputProps={{ name: 'age', id: 'age-simple', }}>
<MenuItem value=""><em>None</em></MenuItem>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</Select>
</FormControl>
</div>
<div className="form-group name">
<FormControl disabled fullWidth>
<InputLabel htmlFor="name-disabled">Name</InputLabel>
<Select
value={this.state.name}
onChange={this.handleChange}
input={<Input name="name" id="name-disabled" />}>
<MenuItem value=""><em>None</em></MenuItem>
<MenuItem value="olivier">Olivier</MenuItem>
<MenuItem value="hai">Hai</MenuItem>
<MenuItem value="kevin">Kevin</MenuItem>
</Select>
<FormHelperText>Disabled</FormHelperText>
</FormControl>
</div>
} Apps.JS
export default class Apps extends React.Component {
render() {
return (
<div className="select-wrapper">
<SimpleSelect/>
</div>
}