Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

22 Commits

Repository files navigation

A Monican Conspiracy

This is not a framework. Just like React.

It lets one create Actions and Stores that are mounted/unmounted with a parent View.

Installation

npm install monican

Usage

Example

importReact,{PropTypes}from'react';import{render}from'react-dom';import{View}from'monican';constChildView=View({displayName: 'YourChildView',actionsUse: {/// Action groupparentActions: {/// Action name and the type of it's argument:onClickSomething: PropTypes.any,},},storesUse: {/// Store nameparentStore: {/// Store value name and its type:clickCounter: PropTypes.number,},},render(){return(<buttononClick={this.actions.parentActions.onClickSomething}>
Click me ({this.props.parentStore.clickCounter})
</button>);},});constparentActions={onClickSomething: PropTypes.any,};constparentStore={getInitialState(){return{clickCounter: 0};},getActionHandlers(){return{parentActions: {onClickSomething: this.onClickSomething,},};},onClickSomething(arg,{ state }){return{clickCounter: state.clickCounter+1};},};constParentView=View({displayName: 'YourParentView',actionsCreate: {parentActions: parentActions,},storesCreate: {parentStore: parentStore,},render(){return(<div><h2>Parent view</h2><p>{'Button has been clicked: '+this.props.parentStore.clickCounter+' times.'}</p><ChildView/></div>);},});constdiv=document.createElement('div');render(<ParentView/>,div);document.body.appendChild(div);

License

A Monican Conspiracy is MIT licensed.

About

A Monican Conspiracy

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages