All Projects β†’ combine β†’ Universal React Redux

combine / Universal React Redux

🧐 A sensible universal starter kit for React + Redux

Programming Languages

javascript
184084 projects - #8 most used programming language
es2015
71 projects

Projects that are alternatives of or similar to Universal React Redux

React Redux Universal Boilerplate
An Universal ReactJS/Redux Boilerplate
Stars: ✭ 165 (+47.32%)
Mutual labels:  webpack, babel, hot-reload, react-router, css-modules
React Pages Boilerplate
Deliver react + react-router application to gh-pages
Stars: ✭ 134 (+19.64%)
Mutual labels:  webpack, babel, hot-reload, react-router, css-modules
React Ssr Setup
React Starter Project with Webpack 4, Babel 7, TypeScript, CSS Modules, Server Side Rendering, i18n and some more niceties
Stars: ✭ 678 (+505.36%)
Mutual labels:  webpack, babel, react-router, css-modules
React Cool Starter
😎 🐣 A starter boilerplate for a universal web app with the best development experience and a focus on performance and best practices.
Stars: ✭ 1,083 (+866.96%)
Mutual labels:  webpack, react-router, server-side-rendering, css-modules
V2 Universal Js Hmr Ssr React Redux
⚑ (V2) Universal JS - Server Side Rendering, Code Splitting and Hot Module Reloading ⚑
Stars: ✭ 147 (+31.25%)
Mutual labels:  hot-reload, react-router, server-side-rendering, react-router-v4
Project Webcube
Continuously updated JS infrastructure for modern web dev
Stars: ✭ 141 (+25.89%)
Mutual labels:  webpack, babel, react-router, server-side-rendering
Js Stack Boilerplate
Final boilerplate code of the JavaScript Stack from Scratch tutorial –
Stars: ✭ 145 (+29.46%)
Mutual labels:  webpack, babel, react-router, server-side-rendering
React
Extremely simple boilerplate, easiest you can find, for React application including all the necessary tools: Flow | React 16 | redux | babel 6 | webpack 3 | css-modules | jest | enzyme | express + optional: sass/scss
Stars: ✭ 244 (+117.86%)
Mutual labels:  webpack, babel, react-router, css-modules
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 (-8.04%)
Mutual labels:  webpack, babel, react-router, react-router-v4
React Boilerplate
Production-ready boilerplate for building universal web apps with React and Redux
Stars: ✭ 53 (-52.68%)
Mutual labels:  webpack, babel, css-modules
Simple Universal React Redux
The simplest possible Async Universal React & Redux Boilerplate app, that works on both Mac and Windows
Stars: ✭ 58 (-48.21%)
Mutual labels:  babel, react-router, react-router-v4
Starter React Flux
Generate your React PWA project with TypeScript or JavaScript
Stars: ✭ 65 (-41.96%)
Mutual labels:  webpack, babel, react-router
React 5ddm
5dεŠ¨ζΌ«οΌŒδ½Ώη”¨ReactοΌŒζœεŠ‘η«―ζΈ²ζŸ“οΌŒζŽ₯口(不开源)ζ₯θ‡ͺθ΅žη‰‡CMSγ€‚δ»…δΎ›ε‚θ€ƒοΌŒδΊ€ζ΅ηΎ€οΌš14646823 欒迎加ε…₯
Stars: ✭ 50 (-55.36%)
Mutual labels:  webpack, react-router, css-modules
React Redux Antdesign Webpack Starter
react + redux + ant design + react-router 4 + webpack 4 starter
Stars: ✭ 44 (-60.71%)
Mutual labels:  webpack, react-router, react-router-v4
Budgeting
Budgeting - React + Redux + Webpack (tree shaking) Sample App
Stars: ✭ 971 (+766.96%)
Mutual labels:  webpack, babel, react-router
Starter Lapis
Cutting edge starter kit
Stars: ✭ 72 (-35.71%)
Mutual labels:  webpack, react-router, server-side-rendering
Koa Mobx React Starter
A straightforward starter for Node javascript web projects. Using Koa, MobX and ReactJS (with universal / isomorphic server rendering)
Stars: ✭ 102 (-8.93%)
Mutual labels:  webpack, babel, react-router
Express React Boilerplate
πŸš€πŸš€πŸš€ This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: ✭ 32 (-71.43%)
Mutual labels:  webpack, babel, react-router
Ssr React
How to server-side render React, hydrate it on the client and combine client and server routes
Stars: ✭ 67 (-40.18%)
Mutual labels:  expressjs, react-router, server-side-rendering
Mern
πŸŽ‰ This is boilerplate for MERN stack with integrations like Redux and SSR πŸŽ‰
Stars: ✭ 77 (-31.25%)
Mutual labels:  webpack, expressjs, server-side-rendering

Universal React Redux Boilerplate

A universal React/Redux boilerplate with sensible defaults. Out of the box, this boilerplate comes with:

Philosophy

The JavaScript ecosystem is brimming with open source libraries. With advances in ES6 and commitments by the big tech companies to invest in JavaScript, the last several years have arguably turned web development into what was once a huge pain in the ass, to a pretty decently enjoyable experience.

With so many different packages now available, we now have the freedom and the choice to craft applications to our exact specifications, reducing bloat and minimizing the number of code we need to support cross-platform apps. It really is a new world.

However, with so many different developers working on different libraries, things are constantly in flux, and breaking changes are often introduced. It can be hard to keep up with the latest and greatest since they're always changing.

To help alleviate this, we've collected some of the best practices and features from the React ecosystem and put them in one place. Although this boilerplate is fully production-capable as is, its main goal is to serve as an example of how to bring an application together using the latest tools in the ecosystem.

Development Mode

Copy environment variables and edit them if necessary:

cp .env.example .env

Then:

npm install
npm start

Direct your browser to http://localhost:3000.

Production Builds

Add environment variables the way you normally would on your production system.

npm run prod:build
npm run serve

Or simply:

npm run prod

If using Heroku, simply add a Procfile in the root directory. The postinstall script will do the rest.

web: npm run serve

Path Aliases

In package.json, there is a property named _moduleAliases. This object defines the require() aliases used by both webpack and node.

Aliased paths are prefixed with one of two symbols, which denote different things:

@ - component and template paths, e.g. @components

$ - server paths that are built by babel, e.g. server/api

Aliases are nice to use for convenience, and lets us avoid using relative paths in our components:

// This sucks
import SomeComponent from '../../../components/SomeComponent';

// This is way better
import SomeComponent from '@components/SomeComponent';

You can add additional aliases in package.json to your own liking.

Environment Variables

In development mode, environment variables are loaded by dotenv off the .env file in your root directory. In production, you'll have to manage these yourself.

An example with Heroku:

heroku config:set FOO=bar

CSS Modules

This project uses CSS Modules. Class names should be in camelCase. Simply import the .scss file into your component, for example:

β”œβ”€β”€ components
β”‚   β”œβ”€β”€ Header.js
β”‚   β”œβ”€β”€ Header.scss
// Header.scss
.headerContainer {
  height: 100px;
  width: 100%;
}
// Header.js
import css from './Header.scss';

const Header = (props) => {
  return (
    <div className={css.headerContainer}>
      {...}
    </div>
  );
}

Redux Devtools

This project supports the awesome Redux Devtools Extension. Install the Chrome or Firefox extension and it should just work.

Pre-fetching Data for Server Side Rendering (SSR)

When rendering components on the server, you'll find that you may need to fetch some data before it can be rendered. The component renderer looks for a fetchData method on the container component and its child components, then executes all of them and only renders after the promises have all been resolved.

//  As an ES6 class

class TodosContainer extends React.Component {
  static fetchData = ({ store }) => {
    return store.dispatch(fetchTodos());
  };
}

// As a functional stateless component

const TodosContainer = (props) => {
  const { todos } = props;
  return (
    // ...component code
  );
}

TodosContainer.fetchData = ({ store }) => {
  return store.dispatch(fetchTodos());
}

Async / Await

This project uses async/await, available by default in Node.js v8.x.x or higher. If you experience errors, please upgrade your version of Node.js.

Testing

The default testing framework is Jest, though you can use whatever you want.

Tests and their corresponding files such as Jest snapshots, should be co-located alongside the modules they are testing, in a spec/ folder. For example:

β”œβ”€β”€ components
β”‚   β”œβ”€β”€ todos
β”‚   β”‚   β”œβ”€β”€ TodoForm
β”‚   β”‚   β”‚   β”œβ”€β”€ spec
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ TodoForm.test.js
β”‚   β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”‚   β”œβ”€β”€ index.scss

Tests can be written with ES2015, since it passes through babel-register.

Running Tests

To run a single test:

npm test /path/to/single.test.js

// Or, to watch for changes
npm run test:watch /path/to/single.test.js

To run all tests:

npm run test:all

// Or, to watch for changes
npm run test:all:watch

Running ESLint

npm run lint

Check the .eslintignore file for directories excluded from linting.

Changing the public asset path

By default, assets are built into dist/public. This path is then served by express under the path assets. This is the public asset path. In a production scenario, you may want your assets to be hosted on a CDN. To do so, just change the PUBLIC_ASSET_PATH environment variant.

Example using Heroku, if serving via CDN:

heroku config:set PUBLIC_ASSET_PATH=https://my.cdn.com

Example using Heroku, if serving locally:

heroku config:set PUBLIC_ASSET_PATH=/assets
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].