Giter VIP home page Giter VIP logo

isomorphic-react-with-mobx's Introduction

isomorphic-react-with-mobx

React + MobX + React-Router (CSR & SSR)

How to use

git clone [email protected]:L-x-C/isomorphic-react-with-mobx.git
cd isomorphic-react-with-mobx
npm install

Dev (client-side rendering)

npm start
open http://localhost:3000

Production (server-side rendering)

npm run server
open http://localhost:20000

Preview

Login, Register

Login

Add item to list

List

404 page when routes not match

404

F.A.Q

How to fetch data on the server side?

Adding a onEnter function to a component

@action
static onEnter({states, pathname, query, params}) {
    progressStart();
    return Promise.all([
      menuActions.setTDK(states, '列表'),
      jobActions.fetchJobList(states, query)
    ]);
}

How to redirect on the server side?

In src/helpers/location.js, there is a redirect function, you can just import it and use. The catchErr in src/serverRender.js will catch the redirect command and redirect as you wish. It works on both server and client side.

import {redirect} from './helpers/location';

@action
static onEnter({states, query, params}) {
    redirect('http://www.xxx.com');
}

isomorphic-react-with-mobx's People

Contributors

l-x-c avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.