@mcrowe/reapp

Simple app development framework on top of React

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
20Aug 3, 2018May 22, 2017Minified + gzip package size for @mcrowe/reapp in KB

Readme

Reapp

Reapp is a simple state-management and routing library for React. It intentionally defies "best-practices" in order to make apps easy to build without losing the ability to architect large apps well.

  • State is stored in stores which are mutated (shutter!)
  • Routing is done without update the url, or handling back gracefully (oh no!)
  • The entire app is refreshed every time a store is updated (gasp!)

Usage

npm install @mcrowe/reapp --save

import { Store, Router, subscribe } from '@mcrowe/reapp'
import App from './app'
import Home from './scenes'
import Page from './scenes'


// Use "Store" for a subscribable data store
const store = new Store({counter: 5})

store.get().counter // 5

// Update the store and broadcast changes
store.update(v =>
  v.counter += 1
)

store.get().counter = 7
store.set() // broadcast changes outside of a broadcast


// Use "Router" to handle navigation
const router = new Router({path: 'home', params: {}})

router.route('home', App)
router.route('page', Page)

router.push('page', {id: 5})
router.pop()

router.getCurrentRoute() // {path: 'home', params: {}}


// Use "subscribe" to subscribe any component to changes
// in one or more "ISubscribable" (router, store, ...)
const SubscribedApp = subscribe(router, store)(App)

Development

Install npm modules:

npm install

Run tests:

npm test

Release

Release a new version:

bin/release.sh

This will publish a new version to npm, as well as push a new tag up to github.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.