almin-react-container
React bindings for Almin.
Install
Install with npm:
npm install almin-react-container
Usage
create(component, context): React.Component
It create container component that is wrap component
.
The component
can receive context.getState
of Almin via this.props
.
;;;;// Store { thisvalue = value; } { super; thisstate = value: "Hello World!" ; } { return myState: thisstate ; }// Contextconst context = dispatcher: store: ; // context.getState();/*{ myState}*/// ViewComponent { // this.props has the same with `context.getState()` return <div>thispropsmyStatevalue</div> }// Create Containerconst RootContainer = AlminReactContainer;// Render ContainerReactDOM;
TypeScript example:
;;;; // Store ;// Context; // View;// { myState: MyState } // Create Container;// RenderReactDOM.renderRootContainer /, document.body;
For more details, see Example/.
For TypeScript user, see almin-react-container-test.tsx.
Changelog
See Releases page.
Running tests
Install devDependencies and Run npm test
:
npm i -d && npm test
Contributing
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
License
MIT © azu