扫一扫分享
Omniscient是另一个超级实用的插件,它将使你的开发人员的开发起来更加容易。它是一个JavaScript库,但也是一种考虑构建项目的方式。可以将无所不知的组件看作无状态的react组件,但它稍微优化了一些,并且有更多的选项.
例子
var React = require('react');
var Reactdom = require('react-dom');
var component = require('omniscient');
var HelloMessage = component(({name}) => <div>Hello {name}</div>);
ReactDOM.render(<HelloMessage name="John" />, document.querySelector('#app'));
// without JSX
var {div} = React.DOM; // Extract the div convenience function from React
var HelloMessage = component(({name}) => div({}, `Hello ${name}`));
// Omniscient components are interoperable with JSX and non-JSX
ReactDOM.render(HelloMessage({ name: 'John' }), document.querySelector('#app'));
手机预览