TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

React-vdom upgraded to React v0.12.0

1 点作者 gcanti超过 10 年前

1 comment

gcanti超过 10 年前
Hello, I wrote this handy little library for testing purposes: you can extract the vdom from a React component and test it against a JSON with simple tools like assert.deepEqual() and without a real DOM. The extracted vdom has the following type definition:<p><pre><code> type Node = { tag: string, attrs: object&lt;name, value&gt;, children: undefined | null | Node | Array&lt;Node&gt; } </code></pre> If your component handle a private state, you can inject a state to test different configurations.<p>This is an example of massive use in a form generation library:<p><a href="https://github.com/gcanti/tcomb-form/blob/master/test/test.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gcanti&#x2F;tcomb-form&#x2F;blob&#x2F;master&#x2F;test&#x2F;test.j...</a><p>Hope it can help you too.