AG-1053 Tidy react examples, make more idiomatic
This commit is contained in:
21
src-examples/dynamicComponentExample/SquareRenderer.jsx
Normal file
21
src-examples/dynamicComponentExample/SquareRenderer.jsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import React, {Component} from "react";
|
||||
|
||||
export default class SquareRenderer extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
value: this.valueSquared()
|
||||
};
|
||||
}
|
||||
|
||||
valueSquared() {
|
||||
return this.props.value * this.props.value;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<span>{this.state.value}</span>
|
||||
);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user