All Projects → mirrorjs → Mirror

mirrorjs / Mirror

Licence: mit
A simple and powerful React framework with minimal API and zero boilerplate.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mirror

Award
⚙基于react的服务端渲染框架
Stars: ✭ 91 (-93.7%)
Mutual labels:  react-router
React Demo Gather
react demo合集,有自己写的,也有在学习过程中觉得很好的demo收集的,持续更新中
Stars: ✭ 97 (-93.29%)
Mutual labels:  react-router
React Bootstrap Webpack Starter
ReactJS 16.4 + new React Context API +react Router 4 + webpack 4 + babel 7+ hot Reload + Bootstrap 4 + styled-components
Stars: ✭ 103 (-92.87%)
Mutual labels:  react-router
Webpack Core Usage
webpack2完整系列课程,欢迎阅读。同时欢迎移步我的react全家桶文章全集: https://github.com/liangklfangl/react-article-bucket
Stars: ✭ 94 (-93.49%)
Mutual labels:  react-router
Redux Cnode
react+react-router+redux+es6+antd-mobile+webpack版本的Cnode
Stars: ✭ 96 (-93.36%)
Mutual labels:  react-router
Libreact
NO LONGER MAINTAINED - SEE https://github.com/streamich/libreact INSTEAD
Stars: ✭ 100 (-93.08%)
Mutual labels:  react-router
Now Ui Kit React
React version of Now UI Kit by Creative Tim
Stars: ✭ 90 (-93.77%)
Mutual labels:  react-router
React Login
A client side implementation of authentication using react.js for my blog on medium. This is the second part of my previous blog on how to implement scalable node.js server.
Stars: ✭ 105 (-92.73%)
Mutual labels:  react-router
Npm Registry Browser
Browse the npm registry with an SPA made in React, with full dev workflow.
Stars: ✭ 97 (-93.29%)
Mutual labels:  react-router
Koa Mobx React Starter
A straightforward starter for Node javascript web projects. Using Koa, MobX and ReactJS (with universal / isomorphic server rendering)
Stars: ✭ 102 (-92.94%)
Mutual labels:  react-router
Molecule
⚛️ – :atom: – ⚛️ Boilerplate for cross platform web/native react apps with electron.
Stars: ✭ 95 (-93.43%)
Mutual labels:  react-router
Aptutil
Go utilities for Debian APT repositories
Stars: ✭ 95 (-93.43%)
Mutual labels:  mirror
Rtlcss
Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
Stars: ✭ 1,363 (-5.67%)
Mutual labels:  mirror
React Antd Admin
用React和Ant Design搭建的一个通用管理后台
Stars: ✭ 1,313 (-9.13%)
Mutual labels:  react-router
Mclone
mclone - 麻麻再也不用担心拉取GitHub代码慢了
Stars: ✭ 104 (-92.8%)
Mutual labels:  mirror
React Atomic Structure
Basic Structure for React app following Atomic Design
Stars: ✭ 89 (-93.84%)
Mutual labels:  react-router
React Antd Admin
一個简洁的 antd-react-admin 应用 -- React + Antd 后台管理系统
Stars: ✭ 99 (-93.15%)
Mutual labels:  react-router
Dva Boot Admin
🍰 react admin dashboard ui LANIF-ADMIN --- react 16 + react-router 4 + dva 2 + antd 4 后台管理 脚手架
Stars: ✭ 1,553 (+7.47%)
Mutual labels:  react-router
Hmirror
Mirror of multiple third-party blocklists (updated daily).
Stars: ✭ 104 (-92.8%)
Mutual labels:  mirror
Nod32 Update Mirror
🔶 ESET Nod32 Updates Mirror
Stars: ✭ 100 (-93.08%)
Mutual labels:  mirror

Mirror

npm version build status coverage status license

查看中文

A simple and powerful React framework with minimal API and zero boilerplate. (Inspired by dva and jumpstate)

Painless React and Redux.

Why?

We love React and Redux.

A typical React/Redux app looks like the following:

  • An actions/ directory to manually create all action types (or action creators)
  • A reducers/ directory and tons of switch clause to capture all action types
  • Apply middlewares to handle async actions
  • Explicitly invoke dispatch method to dispatch all actions
  • Manually create history to router and/or sync with store
  • Invoke methods in history or dispatch actions to programmatically changing routes

The problem? Too much boilerplates and a little bit tedious.

In fact, most part of the above steps could be simplified. Like, create actions and reducers in a single method, or dispatch both sync and async actions by simply invoking a function without extra middleware, or define routes without caring about history, etc.

That's exactly what Mirror does, encapsulates the tedious or repetitive work in very few APIs to offer a high level abstraction with efficiency and simplicity, and without breaking the pattern.

Features

  • Minimal API(only 4 newly introduced)
  • Easy to start
  • Actions done easy, sync or async
  • Support code splitting
  • Full-featured hook mechanism

Getting Started

Creating an App

Use create-react-app to create an app:

$ npm i -g create-react-app
$ create-react-app my-app

After creating, install Mirror from npm:

$ cd my-app
$ npm i --save mirrorx
$ npm start

index.js

import React from 'react'
import mirror, {actions, connect, render} from 'mirrorx'

// declare Redux state, reducers and actions,
// all actions will be added to `actions`.
mirror.model({
  name: 'app',
  initialState: 0,
  reducers: {
    increment(state) { return state + 1 },
    decrement(state) { return state - 1 }
  },
  effects: {
    async incrementAsync() {
      await new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve()
        }, 1000)
      })
      actions.app.increment()
    }
  }
})

// connect state with component
const App = connect(state => {
  return {count: state.app}
})(props => (
    <div>
      <h1>{props.count}</h1>
      {/* dispatch the actions */}
      <button onClick={() => actions.app.decrement()}>-</button>
      <button onClick={() => actions.app.increment()}>+</button>
      {/* dispatch the async action */}
      <button onClick={() => actions.app.incrementAsync()}>+ Async</button>
    </div>
  )
)

// start the app,`render` is an enhanced `ReactDOM.render`
render(<App />, document.getElementById('root'))

Demo

Guide

See Guide.

API

See API Reference.

Examples

Change log

See CHANGES.md.

FAQ

Does Mirror support TypeScript?

Yes, it does.

Does Mirror support Redux DevTools Extension?

Yes, Mirror integrates Redux DevTools by default to make your debugging more easily.

Can I use extra Redux middlewares?

Yes, specify them in mirror.defaults is all you need to do, learn more from the Docs.

I'm really into Redux-Saga, is there any way to use it in Mirror?

Yes of course, take a look at the addEffect option.

Which version of react-router does Mirror use?

react-router v4.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].