Package Exports
- react-nc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-nc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React-NC
Installation
npm install react-nc --saveExample
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import CTRL, { StateControl } from 'react-nc';
CTRL.initializeState({
name: "iNont"
});
let StateCTRL = StateControl(App);
ReactDOM.render(
<StateCTRL />
, document.getElementById('root'));App.js
import React, { Component } from 'react';
import CTRL from 'react-nc';
class App extends Component {
render() {
return (
<div>
My name is {CTRL.state.name}.
<input value={CTRL.state.name} placeholder="Type to change name"
onChange={(event)=>CTRL.setState({ name: event.target.value })} />
</div>
);
}
}
export default App;
Commands
CTRL.initializeState(initialState)CTRL.setState(state)CTRL.resetState()CTRL.forceUpdate()