keyanzhang's recent timeline updates
keyanzhang

keyanzhang

🏢  Facebook
V2EX member #46137, joined on 2013-09-29 03:12:14 +08:00
keyanzhang's recent replies
@JiaFeiX 不是,是 web 端。但这个项目其实很像 react-native-cli ( Vjeux 也是这次的主要作者之一)。
如果你想出国的话,可以考虑一下 UNNC : http://www.nottingham.edu.cn/en/index.aspx
disclaimer :我不知道你的分数在山东来 UNNC 会不会是个 overkill ,但 UNNC 给了我很多在其它地方得不到的体验。 Just my 2 cents 。
Jun 12, 2016
Replied to a topic by daimoon 前端开发 说说我为什么选择了 vue 而不是 react
请问您觉得 React 的文档有哪些地方可以改进呢
不知道现在回复是否支持 Markdown 了,如果不支持的话请看上面的 gist 。

这段代码应该来自 https://github.com/fbsamples/f8app/blob/master/js/common/F8StyleSheet.js

`...` 是通过 [babel]( http://babeljs.io/) 转译的 Rest/Spread 。具体请看 https://github.com/sebmarkbage/ecmascript-rest-spread
- `let {ios, android, ...style} = obj` 可以理解成 `let ios = obj.ios; let android = obj.android; let style = "obj 中除去 ios 和 android 之外的所有 property";`
- `let` 右侧的 `{...styles[name]}` 可以理解成 `Object.assign({}, styles[name]);`
- 同理,`style = {...style, ...android};` 会被 babel 转译成 `style = Object.assign({}, style, android);`

函数签名中的 `: Object` 以及 `: {[name: string]: number}` 是 [flow]( https://flowtype.org/) 的类型标注(并不是 TypeScript )。换句话说,`create` 这个函数接受一个类型为 `Object` 的参数 `styles`,并返回一个类型为 `{[name: string]: number}` 的值。
- 除去 `number`、`string`、`boolean`、`null` 以及 `undefined` 之外的任何类型均可被标注为 `Object`
- https://flowtype.org/docs/objects.html#the-object-type
- `{[name: string]: number}` 代表这是一个从 `string` 到 `number` 的映射。举个例子的话,这个函数返回 `{ a: 12, b: 13 }` 是没有问题的,但如果返回 `{ a: 12, b: 'foo' }` 则会报错,因为 `'foo'` 是一个 `string` 而不是 `number`
- https://flowtype.org/docs/objects.html#objects-as-maps
Jun 6, 2016
Replied to a topic by iugo React 组件中 setState() 如何细粒度操作?
@lizheming 不建议您这样手动 mutate this.state 然后使用 forceUpdate 。这其实是一个 anti-pattern : this.state 这个 object 本身不会发生变化( oldState === newState ),而且像您说的一样这会跳过 shouldComponentUpdate 。换句话说就是您没有办法对是否需要 render 这件事做清晰的逻辑判断了。另外一个例子是如果 https://github.com/facebook/react/pull/6914 可以被 merge , forceUpdate 也会造成一些 heuristic 上的问题。具体您可以看 https://github.com/facebook/react/pull/6914/files#diff-748cbc3aec3f23e1ba85ea1706063ccfR178
JS 语言本身的话, https://github.com/kolodny/exercises 这个挺好的。 throttle 、 debounce 、 once 、以及 flatten 这些都各有考察的方面。

HTML 和 CSS 的话可以写个三栏布局之类的东西。不要求 bug-free ,但可以看出基本功如何。

我遇到过比较有趣的面试是给一个 API endpoint ,然后在一小时之内用 React 做出有趣的东西来。可以 Google 以及使用任何第三方 lib 或工具。但要提前给面试者搭好 boilerplate 和 build tools ,要不一小时全花在 webpack 配置上了……
Mar 24, 2016
Replied to a topic by sox Node.js 很多人不理解 NPM 上 left-pad 这样的模块的意义
我觉得这背后的问题是 node.js 缺少一个优秀的 stdlib 。 TJ 老师也说过这个问题。 https://twitter.com/tjholowaychuk/status/665308077420183553
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   761 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms · UTC 21:03 · PVG 05:03 · LAX 14:03 · JFK 17:03
♥ Do have faith in what you're doing.