Skip to content

Commit 3d31bd1

Browse files
committed
Update README
1 parent aca459e commit 3d31bd1

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,23 @@ npm start
2828

2929
## Exercise
3030

31-
Before you start, there are two types of components [Functional Components and Class Components](https://reactjs.org/docs/components-and-props.html#function-and-class-components). Try to use a Functional component if the component doesn't have state, you'll need to refactor code a few times during the next exercise 😁
31+
Before you start, there are two types of components [Functional Components and Class Components](https://reactjs.org/docs/components-and-props.html#function-and-class-components).
32+
33+
```javascript
34+
function Welcome(props) {
35+
return <h1>Hello, {props.name}</h1>;
36+
}
37+
```
38+
39+
```javascript
40+
class Welcome extends React.Component {
41+
render() {
42+
return <h1>Hello, {this.props.name}</h1>;
43+
}
44+
}
45+
```
46+
47+
Try to use a Functional component if the component doesn't have state, you'll need to refactor code a few times during the next exercise 😁
3248

3349
### Tasks
3450

0 commit comments

Comments
 (0)