react-generate-props:根据您的React组件的PropType生成默认道具

时间:2021-05-01 02:35:23
【文件属性】:
文件名称:react-generate-props:根据您的React组件的PropType生成默认道具
文件大小:52KB
文件格式:ZIP
更新时间:2021-05-01 02:35:23
react enzyme jest test props React生成道具 根据您的React组件的PropType生成默认道具 generateProps ( { name : PropTypes . string , number : PropTypes . number } ) // => { name: 'name', number: 1 } 安装 $ npm install --save-dev react-generate-props 用法 重要:将任何组件导入测试套件之前,请初始化库。 // test-helper.js import { init } from 'react-generate-props' init ( ) 定义组件的propTypes。 const Counter = ( { count } ) => < div> { count } < / div > Counter . propTypes = {
【文件预览】:
react-generate-props-master
----.travis.yml(70B)
----.babelrc(39B)
----package.json(3KB)
----test()
--------mocha.opts(45B)
--------main.js(29KB)
--------utils()
----LICENSE(1KB)
----package-lock.json(184KB)
----src()
--------prop-types.js(138B)
--------main.js(4KB)
----.gitignore(599B)
----CHANGELOG.md(2KB)
----.envrc(38B)
----README.md(4KB)

网友评论