一、Algorithm
字符串第一位入栈,之后的每一位依次和前一位匹配,匹配成功,出栈,不成功则入栈。最终,栈为空,则是有效括号,否则无效。
二、Review
9 Tips for Building Awesome Reusable React Components
9条编写完美可复用React组件的建议
- Use TypeScript — avoid prop-types
使用TypeScript做类型检查,避免使用prop-types
TypeScript and prop-types are currently two of the most popular ways to type-check React code. The former validates types at compile-time, whereas the latter performs at runtime.
TypeScript and prop-types是目前React中最流行的类型检查方法,前者在编译时检查,而后者则是在运行时检查。 - Define Components (Not Just Props & Events)
定义组件(不只是props 和 Events) - Write Your TS in a Way that Enables Auto Documentation
写TS时要启用文档自动生成功能 - Inherit Prop Types for Native-HTML-like Components
- One Directory For Each Component
为组件编写目录 - Use Aliases
- Use Enums (Instead of Multiple Booleans) 使用枚举值,而不是过多使用布尔值
- Set Defaults
- Restrict styling with themes
通过主题限制组件的样式
To provide better predictability to your component’s behavior (including its visual appearance) limit the degree of freedom your component consumers have in overriding your component styling properties.
三、Tip
使用gitbook serve 和gitbook build时莫名报错(之前一切正常),如图
/.gitbook/versions/版本/lib/output/website/copyPluginAssets.js