ReactDOM.render(
<React.StrictMode>
<MyClassComponent />
</React.StrictMode>,
document.getElementById('root')
);
import './MyClassComponent.css';
class MyClassComponent extends React.Component {
render() {
return (
<div>My text</div>
);
}
}
export default MyClassComponent;
function myFunctionComponent() {
return '<div>My text</div>'
}
class MyClassComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<div>{this.props.item.name}</div>
</div>
);
}
}
export default ExpenseEntryItem;
const item = {
id: 1,
name: "Peter",
}
ReactDOM.render(
<React.StrictMode>
<MyClassComponent item={item} />
</React.StrictMode>,
document.getElementById('root')
);
class MyClassComponent extends React.Component {
click() {
// ...
}
render() {
return (
<button onClick={() => this.click()}>
Click me
</button>
);
}
}
const store = createStore()
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
)