项目作者: rocketstation

项目描述 :
Combines behavior, presentation, structure in one place
高级语言: JavaScript
项目地址: git://github.com/rocketstation/black-box.git
创建时间: 2018-02-25T05:02:02Z
项目社区:https://github.com/rocketstation/black-box

开源协议:

下载


Black Box

Black Box is a lightweight & powerful tool based on React & Fela. It combines behavior, presentation, structure in one place

Installation

  1. npm i --save @rocketstation/black-box

Usage

  1. import $ from '@rocketstation/black-box'
  2. const MyComponent = ({ name, ...props }) =>
  3. $(
  4. 'div',
  5. {
  6. onClick: () => { console.log('test') },
  7. skin: {
  8. backgroundColor: 'black',
  9. color: 'white',
  10. },
  11. ...props
  12. },
  13. 'Hello',
  14. $('span', name),
  15. '!'
  16. )
  17. ReactDOM.render(
  18. $(MyComponent, { name: 'John Doe' }),
  19. document.getElementById('app')
  20. )

Reserved Props

skin - if it is object or function, it will be removed from props & passed to Fela.combineRules

key - will be passed to the root component

Motivation

BlackBox adds extra configuration to React.createElement

Why not to use JSX

JSX is not JS. It tries to combine HTML & JS syntax inside JS. It limits JS features & adds new language hacks & overheads. Moreover, JSX requires closing tags

License

Black Box is licensed under the MIT License

Created by RocketStation