Browse Source
Update typechecking-with-proptypes.md
add 'javascript' after ```
main
kinyaying
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
content/docs/typechecking-with-proptypes.md
|
|
@ -147,7 +147,7 @@ MyComponent.propTypes = { |
|
|
|
|
|
|
|
You can define default values for your `props` by assigning to the special `defaultProps` property: |
|
|
|
|
|
|
|
``` |
|
|
|
```javascript |
|
|
|
const defaultProps = { |
|
|
|
name: 'Stranger' |
|
|
|
}; |
|
|
@ -172,7 +172,7 @@ ReactDOM.render( |
|
|
|
|
|
|
|
You can also put propTypes and defaultProps as static props inside React class. |
|
|
|
|
|
|
|
``` |
|
|
|
```javascript |
|
|
|
class Greeting extends Component { |
|
|
|
|
|
|
|
static defaultProps = { |
|
|
|