Giter Site home page Giter Site logo

wahengchang / react-redux-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
108.0 12.0 27.0 68 KB

It is a boilerplate of React-Redux as the infrastructure, which helps to setup a Web APP quickly

License: MIT License

JavaScript 97.54% CSS 2.46%
react redux boilerplate tutorial example helloworld universal isomorphic infrastructure createstore

react-redux-boilerplate's Introduction

react-redux-boilerplate

  • It is React-Redux as infrastructure boilerplate, with this developers just focus on developing component, action creator and reducer, without spending time in router, dev/pro build enviroement, wiring up file and express as HTTP server.

Read more

Install

$ git clone https://github.com/wahengchang/react-redux-boilerplate
$ npm install

Run (Develop Mode)

It is runnign in Development mode, enable HMR

$ npm run dev
open http://localhost:3000/

Run (Production Mode)

  • Compiling react/redux script to browser use lib, with webpack default optimized config.
  • Disable unnecessary funtionality which helps to debug in development mode
$ npm run build
$ node dist/server.js 

lint

lint fix

$ npm run lint:fix

lint check

$ npm run lint

Storybook

$ npm run storybook

Test

More detail: about test of action creater, component, container and reducer

$ npm run test


Test Suites: 4 passed, 4 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        1.824s, estimated 2s

or watch mode

$ npm run test:watch

Server Rendering Structure

Server Rendering structure Above is the structure of how the whole app works, the app bases on Express web framework, which serves only one route, with res.sendFile function to put index.html into the browser. Inside the scoop of the structure, what we are interested is the blue box, the interaction between react component, redux, root component, store and reducer.

Shared Components

react-redux-universial-container-compont

React-Redux Structure

react-helloworld-component-5-20 index.js , as the entry file and a high level root component, which gathers all the sub-component as the subtree of the Virtual DOM, also it is the only file entangled with many independent modules. Apart from it, different file requires independent modules, which makes clean code and work independently.

Credit

react-redux-boilerplate's People

Contributors

hangeer avatar wahengchang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-redux-boilerplate's Issues

Images

How would you handle importing images?

warning.js?1096:36 Warning: React attempted to reuse markup in a container but the checksum was invalid.

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:

image

Routing doesn't seem to work with Link

I was trying to use Link from 'react-router-dom' but the routing doesn't work

hello.js

import { Link } from 'react-router-dom'
import style from './Hello.css'

const Hello = ({ onClick, message }) => {
  return (
    <div>
      <Link to="/preload"><h1 className={classNames(style['title'])}>{ message }</h1></Link>
      <button onClick={onClick}>Click</button>
    </div>
  )
}

But the transition just doesn't happen

Could you please help me? Also I was looking at using react-router-redux with history but the updated code wasn't working although I followed the same tutorials as per here https://github.com/reactjs/react-router-redux

Thanks,
Rahul Basu

HMR + auto reload

Hi, i tried to understand this boilerplate. I do install and run using dev mode and make a few change to the file. Its working fine but am i suppose to manually refresh the browser everytime i do a js/css/html code change? HMR alone will only update the component where code is changed, but it doesnt reload automatically right?

Uncaught SyntaxError: Unexpected token <

Problem occurs when running "dev".
I am running win 8.1 so I needed to change scripts to work as follows:
"dev": "set NODE_ENV=development && babel-node ./src/server.js --presets es2015,react,stage-2 ./srcserver.js",

Though I'm not sure if that caused the issue.

404

does not render anything 404 error

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.