Skip to content

Commit 89ecb68

Browse files
committed
Refactored <TextWidget> to render the text to display from its state field 'text', and initialized that field to the same text as rendered previously.
1 parent 07d74e9 commit 89ecb68

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

webpack_in/entry.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ class HelloWidget extends React.Component {
4747
class TextWidget extends React.Component {
4848
constructor(props) {
4949
super(props);
50+
51+
this.state = {
52+
text: "Some text here...."
53+
};
5054
}
5155

5256
render() {
5357
return (
5458
<div style={ objStyleCommon }>
55-
<div style={ objStyleContent }>Some text here....</div>
59+
<div style={ objStyleContent }>{ this.state.text }</div>
5660
<ButtonWidget caption="Change text..." />
5761
</div>
5862
);

0 commit comments

Comments
 (0)