File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
fixtures/ssr/src/components Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,17 @@ const autofocusedInputs = [
1111] ;
1212
1313export default class Page extends Component {
14- state = { active : false } ;
14+ state = { active : false , value : '' } ;
1515 handleClick = e => {
1616 this . setState ( { active : true } ) ;
1717 } ;
18+ handleChange = e => {
19+ this . setState ( { value : e . target . value } ) ;
20+ } ;
21+ componentDidMount ( ) {
22+ // Rerender on mount
23+ this . setState ( { mounted : true } ) ;
24+ }
1825 render ( ) {
1926 const link = (
2027 < a className = "link" onClick = { this . handleClick } >
@@ -30,6 +37,10 @@ export default class Page extends Component {
3037 < p > Autofocus on page load: { autofocusedInputs } </ p >
3138 < p > { ! this . state . active ? link : 'Thanks!' } </ p >
3239 { this . state . active && < p > Autofocus on update: { autofocusedInputs } </ p > }
40+ < p >
41+ Controlled input:{ ' ' }
42+ < input value = { this . state . value } onChange = { this . handleChange } />
43+ </ p >
3344 </ Suspend >
3445 </ div >
3546 ) ;
You can’t perform that action at this time.
0 commit comments