Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dt-fe/weekly
Browse files Browse the repository at this point in the history
  • Loading branch information
ascoders committed Jul 30, 2018
2 parents 1bf414a + b3c55b5 commit 196474f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 34.精读《React 代码整洁之道》.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const loadConfig = () => {

> 在 React 使用 defaultProps 代替在代码中动态判断
显然,利用 React 组件的规则,将入参的默认值预先定义好是最高效的。但顺带一句,如果在 ts 最严格的 `stricts` 模式里,依然会报错:变量可能为定义。这是因为 `defaultProps` 依然是个约定,而不能通过强类型推导出,目前还没有更优雅的解决思路。
显然,利用 React 组件的规则,将入参的默认值预先定义好是最高效的。但顺带一句,如果在 ts 最严格的 `stricts` 模式里,依然会报错:变量可能未定义。这是因为 `defaultProps` 依然是个约定,而不能通过强类型推导出,目前还没有更优雅的解决思路。

> 渲染与判断逻辑分开
Expand Down

0 comments on commit 196474f

Please sign in to comment.