react-applications
Write applications with only React and this library! Simply use this to create a configuration document/object or watch and react to the components changing over time.
Usage (API)
You can use the synchronous API by just calling react-applications with some JSX elements.
const React = const reactApps = { return propschildren }const structure = console/*MyComp { state: {}, children: [ { type: 'div', key: null, props: [{ foo: 'bar' }], children: [] } ], props: {}, type: [Function: MyComp] }*/
You can mix objects and JSX at will.
const React = const reactApps = { return foo: 'bar' }console/* { foo: 'bar' } */
Dynamic mode
You can also watch for changes in the components. To do this provide an onChange function. You can also use componentDidUpdate in your components as long as you pass onChange or set the dynamic: true
option.
const ClassComponent extends React.Component componentDidUpdateprevProps prevState snapshot console.log'Component updated! Yay!' } { this }}const structure = // And it's all mounted synchronouslystructurestate // { foo: 'bar' }