New to React and finding it exciting and overwhelming.
I have the following code. I'm trying to increment the font size using a state within the component, and then render the updates to the web page with a bit of text.
constructor(props) {
super(props);
this.state = {
maxSize: this.props.max,
currentSize: this.props.size
};
iSizeClick() {
this.setState({ currentSize: this.state.currentSize < this.state.maxSize ? this.state.currentSize++ : this.state.currentSize });
}
render() {
var size = this.state.currentSize;
return(
<div>
<span id="fontSizeSpan" hidden={this.state.hidden}>{size}</span>
<button id="increaseButton" hidden={this.state.hidden} onClick={this.iSizeClick.bind(this)}>+</button>
<span id="textSpan" onClick={this.handleClick.bind(this)} style={{fontWeight:bold, fontSize:size}}>{this.props.text}</span>
</div>
);
}
I'm failing to see what is limiting my ability to get the component to render with each click of the increment button.