I am trying to display a component when an option is selected from the drop down. I haven't been able to get the "Func" component or any HTML to display but can log stuff to the console.
import React from 'react';
import Func from './components/Func'
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
option: ''
}
this.handleChange = this.handleChange.bind(this)
this.changeFunc = this.changeFunc.bind(this)
}
handleChange(e) {
this.setState({
option: e.target.value
}, this.changeFunc);
}
changeFunc() {
return <Func />
}
render() {
return (
<div>
<label htmlFor="Func">Choose: </label>
<select name="options" id="options" onChange={this.handleChange}>
<option value=""></option>
<option value="Currency Converter">Currency Converter</option>
<option value="Win!">Win!</option>
</select>
</div>
)
}
}
export default App;
Isn't really much there but the Func component:
import React, { Component } from 'react';
class Func extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<h2>
func
</h2>
);
}
}
export default Func;