From 6a467f608bb2b540fce66f26cc39823d5b328835 Mon Sep 17 00:00:00 2001 From: Ivan Tanev Date: Sat, 6 Apr 2019 17:06:18 +0300 Subject: [PATCH] Improve the class component defaultProps example In the current example, we have a type definition for props but do not make use of it for defaultProps. This can lead to a mismatch between defaultProps and props. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6075fd87..5080b1cf 100644 --- a/README.md +++ b/README.md @@ -445,7 +445,7 @@ export class Greet extends React.Component { const { name } = this.props; return
Hello ${name.toUpperCase()}!
; } - static defaultProps = { name: 'world' }; + static defaultProps: Partial = { name: 'world' }; } // Type-checks! No type assertions needed!