Skip to content

Commit 2ce10dd

Browse files
committedApr 24, 2024
Update ReactDOM.render to use createRoot and correct autoFocus attribute
1 parent e5216ec commit 2ce10dd

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

‎src/components/TodoTextInput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default class TodoTextInput extends Component {
4242
})}
4343
type="text"
4444
placeholder={this.props.placeholder}
45-
autoFocus="true"
45+
autoFocus={true}
4646
value={this.state.text}
4747
onBlur={this.handleBlur}
4848
onChange={this.handleChange}

‎src/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react'
2-
import {render} from 'react-dom'
3-
import App from './components/App'
1+
import React from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import App from './components/App';
44

5-
import 'todomvc-app-css/index.css'
5+
import 'todomvc-app-css/index.css';
66

7-
render(
8-
<App />,document.getElementById('root')
9-
)
7+
const container = document.getElementById('root');
8+
const root = createRoot(container);
9+
root.render(<App />);

0 commit comments

Comments
 (0)
Please sign in to comment.