├── .babelrc ├── .dockerignore ├── .editorconfig ├── .eslintrc ├── .flowconfig ├── .gitignore ├── .nvmrc ├── .prettierrc ├── .vscode └── launch.json ├── CHANGELOG.md ├── ISSUE_TEMPLATE.md ├── LICENSE.md ├── README.md ├── components ├── header │ └── Header.js ├── layout │ └── Layout.js └── privateRoute │ └── PrivateRoute.js ├── config └── appConfig.js ├── flow-typed └── npm │ ├── babel-plugin-transform-async-to-generator_vx.x.x.js │ ├── babel-plugin-transform-regenerator_vx.x.x.js │ ├── babel-preset-es2015_vx.x.x.js │ ├── babel-preset-flow_vx.x.x.js │ ├── babel-preset-react_vx.x.x.js │ ├── babel-preset-stage-2_vx.x.x.js │ ├── eslint-plugin-flowtype_vx.x.x.js │ ├── eslint-plugin-react_vx.x.x.js │ ├── eslint_vx.x.x.js │ ├── flow-bin_v0.x.x.js │ └── next_vx.x.x.js ├── mock ├── fakeAPI.json └── userInfosMock.json ├── next.config.js ├── package.json ├── pages ├── _error.js ├── index.js ├── login.js ├── page1.js └── private1.js ├── preview.png ├── redux ├── middleware │ └── fetchMiddleware.js ├── modules │ ├── fakeModuleWithFetch.js │ ├── persistStore.js │ ├── reducers.js │ └── userAuth.js └── store │ ├── configureStore.dev.js │ ├── configureStore.js │ └── configureStore.prod.js ├── services ├── auth.js └── fetchTools.js ├── static ├── css │ └── bootstrap.min.css ├── favicon.ico └── robot.txt ├── typings.json └── typings ├── globals ├── axios │ ├── index.d.ts │ └── typings.json ├── localforage │ ├── index.d.ts │ └── typings.json ├── moment │ ├── index.d.ts │ └── typings.json ├── redux-thunk │ ├── index.d.ts │ └── typings.json └── redux │ ├── index.d.ts │ └── typings.json └── index.d.ts /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "next/babel", 4 | "es2015", 5 | "react", 6 | "stage-2", 7 | "flow" 8 | ], 9 | "plugins": [ 10 | "transform-regenerator", 11 | "transform-async-to-generator" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .git 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "env": { 4 | "browser": true, 5 | "node": true, 6 | "es6": true 7 | }, 8 | "plugins": [ 9 | "react", 10 | "flowtype" 11 | ], 12 | "extends": [ 13 | "plugin:react/recommended", 14 | "plugin:flowtype/recommended" 15 | ], 16 | "parserOptions": { 17 | "ecmaFeatures": { 18 | "arrowFunctions": true, 19 | "binaryLiterals": true, 20 | "blockBindings": true, 21 | "classes": true, 22 | "defaultParams": true, 23 | "destructuring": true, 24 | "forOf": true, 25 | "generators": true, 26 | "modules": true, 27 | "objectLiteralComputedProperties": true, 28 | "objectLiteralDuplicateProperties": true, 29 | "objectLiteralShorthandMethods": true, 30 | "objectLiteralShorthandProperties": true, 31 | "octalLiterals": true, 32 | "regexUFlag": true, 33 | "regexYFlag": true, 34 | "spread": true, 35 | "superInFunctions": true, 36 | "templateStrings": true, 37 | "unicodeCodePointEscapes": true, 38 | "globalReturn": true, 39 | "jsx": true 40 | } 41 | }, 42 | "rules": { 43 | // 44 | //Possible Errors 45 | // 46 | // The following rules point out areas where you might have made mistakes. 47 | // 48 | "comma-dangle": 2, // disallow or enforce trailing commas 49 | "no-cond-assign": 2, // disallow assignment in conditional expressions 50 | "no-console": 1, // disallow use of console (off by default in the node environment) 51 | "no-constant-condition": 2, // disallow use of constant expressions in conditions 52 | "no-control-regex": 2, // disallow control characters in regular expressions 53 | "no-debugger": 2, // disallow use of debugger 54 | "no-dupe-args": 2, // disallow duplicate arguments in functions 55 | "no-dupe-keys": 2, // disallow duplicate keys when creating object literals 56 | "no-duplicate-case": 2, // disallow a duplicate case label. 57 | "no-empty": 2, // disallow empty statements 58 | "no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions 59 | "no-ex-assign": 2, // disallow assigning to the exception in a catch block 60 | "no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context 61 | "no-extra-parens": 0, // disallow unnecessary parentheses (off by default) 62 | "no-extra-semi": 2, // disallow unnecessary semicolons 63 | "no-func-assign": 2, // disallow overwriting functions written as function declarations 64 | "no-inner-declarations": 2, // disallow function or variable declarations in nested blocks 65 | "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor 66 | "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments 67 | "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression 68 | "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions 69 | "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal 70 | "no-sparse-arrays": 2, // disallow sparse arrays 71 | "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement 72 | "use-isnan": 2, // disallow comparisons with the value NaN 73 | "valid-jsdoc": 2, // Ensure JSDoc comments are valid (off by default) 74 | "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string 75 | // 76 | // Best Practices 77 | // 78 | // These are rules designed to prevent you from making mistakes. 79 | // They either prescribe a better way of doing something or help you avoid footguns. 80 | // 81 | "prefer-const": [ 82 | "error", 83 | { 84 | "destructuring": "any", 85 | "ignoreReadBeforeAssign": false 86 | } 87 | ], 88 | "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default). 0: deep destructuring is not compatible https://github.com/eslint/eslint/issues/1863 89 | "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default) 90 | "consistent-return": 2, // require return statements to either always or never specify values 91 | "curly": 2, // specify curly brace conventions for all control statements 92 | "default-case": 2, // require default case in switch statements (off by default) 93 | "dot-notation": 2, // encourages use of dot notation whenever possible 94 | "eqeqeq": 2, // require the use of === and !== 95 | "guard-for-in": 2, // make sure for-in loops have an if statement (off by default) 96 | "no-alert": 2, // disallow the use of alert, confirm, and prompt 97 | "no-caller": 2, // disallow use of arguments.caller or arguments.callee 98 | "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default) 99 | //"no-else-return": 2, // disallow else after a return in an if (off by default) 100 | //"no-empty-label": 2, // disallow use of labels for anything other then loops and switches 101 | "no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default) 102 | "no-eval": 2, // disallow use of eval() 103 | "no-extend-native": 2, // disallow adding to native types 104 | "no-extra-bind": 2, // disallow unnecessary function binding 105 | "no-fallthrough": 2, // disallow fallthrough of case statements 106 | "no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default) 107 | "no-implied-eval": 2, // disallow use of eval()-like methods 108 | "no-iterator": 2, // disallow usage of __iterator__ property 109 | "no-labels": 2, // disallow use of labeled statements 110 | "no-lone-blocks": 2, // disallow unnecessary nested blocks 111 | "no-loop-func": 2, // disallow creation of functions within loops 112 | "no-multi-spaces": 0, // disallow use of multiple spaces 113 | "no-multi-str": 2, // disallow use of multiline strings 114 | "no-native-reassign": 2, // disallow reassignments of native objects 115 | "no-new": 2, // disallow use of new operator when not part of the assignment or comparison 116 | "no-new-func": 2, // disallow use of new operator for Function object 117 | "no-new-wrappers": 2, // disallows creating new instances of String,Number, and Boolean 118 | "no-octal": 2, // disallow use of octal literals 119 | "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251"; 120 | "no-param-reassign": 2, // disallow reassignment of function parameters (off by default) 121 | "no-process-env": 2, // disallow use of process.env (off by default) 122 | "no-proto": 2, // disallow usage of __proto__ property 123 | "no-redeclare": 2, // disallow declaring the same variable more then once 124 | "no-return-assign": 2, // disallow use of assignment in return statement 125 | "no-script-url": 2, // disallow use of javascript: urls. 126 | "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default) 127 | "no-sequences": 2, // disallow use of comma operator 128 | "no-throw-literal": 2, // restrict what can be thrown as an exception (off by default) 129 | "no-unused-expressions": 2, // disallow usage of expressions in statement position 130 | "no-void": 2, // disallow use of void operator (off by default) 131 | "no-warning-comments": [ 132 | 0, 133 | { 134 | "terms": [ 135 | "todo", 136 | "fixme" 137 | ], 138 | "location": "start" 139 | } 140 | ], // disallow usage of configurable warning terms in comments": 2, // e.g. TODO or FIXME (off by default) 141 | "no-with": 2, // disallow use of the with statement 142 | "radix": 2, // require use of the second argument for parseInt() (off by default) 143 | "vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default) 144 | "wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default) 145 | "yoda": 2, // require or disallow Yoda conditions 146 | // 147 | // Strict Mode 148 | // 149 | // These rules relate to using strict mode. 150 | // 151 | "strict": 0, // controls location of Use Strict Directives. 0: required by `babel-eslint` 152 | // 153 | // Variables 154 | // 155 | // These rules have to do with variable declarations. 156 | // 157 | "no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) 158 | "no-delete-var": 2, // disallow deletion of variables 159 | "no-label-var": 2, // disallow labels that share a name with a variable 160 | "no-shadow": 2, // disallow declaration of variables already declared in the outer scope 161 | "no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments 162 | "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block 163 | "no-undef-init": 2, // disallow use of undefined when initializing variables 164 | "no-undefined": 2, // disallow use of undefined variable (off by default) 165 | "no-unused-vars": 2, // disallow declaration of variables that are not used in the code 166 | "no-use-before-define": [ 167 | "error", 168 | { 169 | "functions": false, 170 | "classes": true 171 | } 172 | ], // disallow use of variables before they are defined 173 | // 174 | //Stylistic Issues 175 | // 176 | // These rules are purely matters of style and are quite subjective. 177 | // 178 | "indent": [ 179 | 1, 180 | 2 181 | ], // this option sets a specific tab width for your code (off by default) 182 | "brace-style": 1, // enforce one true brace style (off by default) 183 | "camelcase": 1, // require camel case names 184 | "comma-spacing": [ 185 | 1, 186 | { 187 | "before": false, 188 | "after": true 189 | } 190 | ], // enforce spacing before and after comma 191 | "comma-style": [ 192 | 1, 193 | "last" 194 | ], // enforce one true comma style (off by default) 195 | "consistent-this": [ 196 | 1, 197 | "_this" 198 | ], // enforces consistent naming when capturing the current execution context (off by default) 199 | "eol-last": 1, // enforce newline at the end of file, with no multiple empty lines 200 | "func-names": 0, // require function expressions to have a name (off by default) 201 | "func-style": 0, // enforces use of function declarations or expressions (off by default) 202 | "max-nested-callbacks": [ 203 | 1, 204 | 3 205 | ], // specify the maximum depth callbacks can be nested (off by default) 206 | "new-cap": [ 207 | 1, 208 | { 209 | "newIsCap": true, 210 | "capIsNew": false 211 | } 212 | ], // require a capital letter for constructors 213 | "new-parens": 1, // disallow the omission of parentheses when invoking a constructor with no arguments 214 | "newline-after-var": 0, // allow/disallow an empty newline after var statement (off by default) 215 | "no-array-constructor": 1, // disallow use of the Array constructor 216 | "no-inline-comments": 0, // disallow comments inline after code (off by default) 217 | "no-lonely-if": 1, // disallow if as the only statement in an else block (off by default) 218 | "no-mixed-spaces-and-tabs": 1, // disallow mixed spaces and tabs for indentation 219 | "no-multiple-empty-lines": [ 220 | 1, 221 | { 222 | "max": 2 223 | } 224 | ], // disallow multiple empty lines (off by default) 225 | "no-nested-ternary": 1, // disallow nested ternary expressions (off by default) 226 | "no-new-object": 1, // disallow use of the Object constructor 227 | "no-spaced-func": 1, // disallow space between function identifier and application 228 | "no-ternary": 0, // disallow the use of ternary operators (off by default) 229 | //"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines 230 | //"no-underscore-dangle": 1, // disallow dangling underscores in identifiers 231 | "one-var": [ 232 | 1, 233 | "never" 234 | ], // allow just one var statement per function (off by default) 235 | "operator-assignment": [ 236 | 1, 237 | "never" 238 | ], // require assignment operator shorthand where possible or prohibit it entirely (off by default) 239 | "padded-blocks": [ 240 | 1, 241 | "never" 242 | ], // enforce padding within blocks (off by default) 243 | "quotes": [ 244 | 1, 245 | "single" 246 | ], // specify whether double or single quotes should be used 247 | "semi": [ 248 | 1, 249 | "always" 250 | ], // require or disallow use of semicolons instead of ASI 251 | "semi-spacing": [ 252 | 1, 253 | { 254 | "before": false, 255 | "after": true 256 | } 257 | ], // enforce spacing before and after semicolons 258 | "sort-vars": 0, // sort variables within the same declaration block (off by default) 259 | // "space-after-keywords": [1, "always"], // require a space after certain keywords (off by default) 260 | "space-before-blocks": [ 261 | 1, 262 | "always" 263 | ], // require or disallow space before blocks (off by default) 264 | "space-before-function-paren": [ 265 | 1, 266 | { 267 | "anonymous": "always", 268 | "named": "never" 269 | } 270 | ], // require or disallow space before function opening parenthesis (off by default) 271 | //"space-in-brackets": [1, "never"], // require or disallow spaces inside brackets (off by default) 272 | "space-in-parens": [ 273 | 1, 274 | "never" 275 | ], // require or disallow spaces inside parentheses (off by default) 276 | "space-unary-ops": [ 277 | 1, 278 | { 279 | "words": true, 280 | "nonwords": false 281 | } 282 | ], // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) 283 | "spaced-comment": [ 284 | 1, 285 | "always" 286 | ], // require or disallow a space immediately following the // in a line comment (off by default) 287 | "wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default) 288 | // 289 | // ECMAScript 6 290 | // 291 | // These rules are only relevant to ES6 environments and are off by default. 292 | // 293 | "no-var": 2, // require let or const instead of var (off by default) 294 | "generator-star-spacing": [ 295 | 2, 296 | "before" 297 | ], // enforce the spacing around the * in generator functions (off by default) 298 | // 299 | // Legacy 300 | // 301 | // The following rules are included for compatibility with JSHint and JSLint. 302 | // While the names of the rules may not match up with the JSHint/JSLint counterpart, 303 | // the functionality is the same. 304 | // 305 | "max-depth": [ 306 | 2, 307 | 3 308 | ], // specify the maximum depth that blocks can be nested (off by default) 309 | "max-len": [ 310 | 2, 311 | 300, 312 | 2 313 | ], // specify the maximum length of a line in your program (off by default) 314 | "max-params": [ 315 | 2, 316 | 5 317 | ], // limits the number of parameters that can be used in the function declaration. (off by default) 318 | "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default) 319 | "no-bitwise": 0, // disallow use of bitwise operators (off by default) 320 | "no-plusplus": 2, // disallow use of unary operators, ++ and -- (off by default) 321 | // 322 | // eslint-plugin-react 323 | // 324 | // React specific linting rules for ESLint 325 | // 326 | "react/display-name": 0, // Prevent missing displayName in a React component definition 327 | //"react/jsx-quotes": [2, "double", "avoid-escape"], // Enforce quote style for JSX attributes 328 | "jsx-quotes": [ 329 | 2, 330 | "prefer-double" 331 | ], 332 | // "react/jsx-quotes": 0, 333 | "react/jsx-no-undef": 2, // Disallow undeclared variables in JSX 334 | "react/jsx-sort-props": 0, // Enforce props alphabetical sorting 335 | "react/jsx-uses-react": 2, // Prevent React to be incorrectly marked as unused 336 | "react/jsx-uses-vars": 2, // Prevent variables used in JSX to be incorrectly marked as unused 337 | // "react/no-did-mount-set-state": [2, "allow-in-func"], // Prevent usage of setState in componentDidMount 338 | // "react/no-did-update-set-state": 2, // Prevent usage of setState in componentDidUpdate 339 | "react/no-multi-comp": 0, // Prevent multiple component definition per file 340 | "react/no-unknown-property": 2, // Prevent usage of unknown DOM property 341 | "react/prop-types": 2, // Prevent missing props validation in a React component definition 342 | "react/react-in-jsx-scope": 0, // Prevent missing React when using JSX: No more need in next js since react is global 343 | "react/self-closing-comp": 2, // Prevent extra closing tags for components without children 344 | "react/jsx-wrap-multilines": 2 // Prevent missing parentheses around multilines JSX 345 | } 346 | } 347 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [lints] 8 | 9 | [options] 10 | module.system=haste 11 | strip_root=true 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store* 3 | Icon? 4 | ._* 5 | 6 | # Windows 7 | Thumbs.db 8 | ehthumbs.db 9 | Desktop.ini 10 | 11 | # Linux 12 | .directory 13 | *~ 14 | 15 | # npm 16 | node_modules 17 | *.log 18 | *.gz 19 | 20 | # intelliJ 21 | .idea/ 22 | 23 | # Coveralls 24 | coverage 25 | 26 | # next 27 | .next/ 28 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "trailingComma": "all", 4 | "bracketSpacing": true, 5 | "jsxBracketSameLine": false, 6 | "singleQuote": true, 7 | "overrides": [], 8 | "printWidth": 80, 9 | "useTabs": false, 10 | "tabWidth": 2, 11 | "parser": "babylon" 12 | } 13 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Utilisez IntelliSense pour en savoir plus sur les attributs possibles. 3 | // Pointez pour afficher la description des attributs existants. 4 | // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "chrome", 9 | "request": "launch", 10 | "name": "Launch Chrome localhost:3000", 11 | "url": "http://localhost:3000", 12 | "webRoot": "${workspaceRoot}" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.3.0 (RELEASED) 2 | - add localforage 3 | 4 | ## 0.2.0 (RELEASED) 5 | - add Private component to handle private page 6 | 7 | ## 0.1.0 (RELEASED) 8 | - add redux store persistance (`redux-persist`) to maintain state accross all application. 9 | - add user authentication 10 | 11 | ## 0.0.1 (RELEASED) 12 | - first bricks of this starter 13 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Version 2 | 1.2.0 3 | 4 | ### Node JS 5 | v7.x | v8.X 6 | 7 | ### Browser 8 | Chrome 64.x | Safari 11.x 9 | 10 | ### OS version 11 | macOS | windows 10 | linux Ubuntu... 12 | 13 | ### Steps to reproduce 14 | 1. 15 | 2. 16 | 3. 17 | 18 | ### Expected behavior 19 | What should happen 20 | 21 | ### Actual behavior 22 | What is happening 23 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # LICENSE 2 | 3 | The MIT License (MIT) 4 | 5 | Copyright (c) 2019 Erwan DATIN 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/MacKentoch/react-redux-nextjs-bootstrap-starter) 2 | 3 | # Next JS + React + Redux + Redux persist + redux-devtools-extension + Bootstrap starter 4 | 5 | > A NextJS starter with redux and bootstrap 6 | 7 | 8 | 9 | ![preview](./preview.png) 10 | 11 | 12 | 13 | [See it in action deployed with `now`](https://react-redux-nextjs-bootstrap-starter-xfdpqhzseq.now.sh/) 14 | 15 | ## Detailed Content 16 | 17 | **Front:** 18 | - Next js (4.x+ [github :link:](https://github.com/zeit/next.js)) 19 | - React JS (16.x+ - [github :link:](https://github.com/facebook/react)) 20 | - redux (*as your application grows managing state will be a serious concern, save pain with Redux*) 21 | - redux-persist (*simplifies your NextJS state share between pages* [github :link:](https://github.com/rt2zz/redux-persist)) 22 | - localforage (*for better performances than localStorage*) 23 | - react-redux (*Redux is not specific to ReactJS, you could easily use it with Angular2 for instance*) 24 | - redux-thunk (*simple and does the job*) 25 | - next-redux-wrapper 26 | - redux-devtools-extension ([github :link:](https://github.com/zalmoxisus/redux-devtools-extension#redux-devtools-extension)) 27 | - react-bootstrap ([github :link:](https://github.com/react-bootstrap/react-bootstrap)) 28 | - axios ([github :link:](https://github.com/mzabriskie/axios) *Why: simple, complete, isomorphic ...*) 29 | 30 | **Tool chain:** 31 | - Next js (4.x+ [github :link:](https://github.com/zeit/next.js)) 32 | - Flow JS types 33 | 34 | ## Usage 35 | 36 | IMPORTANT: `Next JS` when `redux` connected 37 | 38 | - **you are forced to connect each page** (*even if you don't need redux in that page*) with `withRedux` from `next-redux-wrapper` (*[see page1 as an example](https://github.com/MacKentoch/react-redux-nextjs-bootstrap-starter/blob/master/pages/page1.js)*). 39 | - **each sub component you may want to connect** should be connected by usual `connect` from `redux` (*[see Header component as an example](https://github.com/MacKentoch/react-redux-nextjs-bootstrap-starter/blob/master/components/header/Header.js)*) 40 | 41 | 42 | ### Install 43 | 44 | ```bash 45 | npm install 46 | ``` 47 | 48 | ### Scripts 49 | 50 |
51 | run dev with hot reload 52 | 53 | Clone this repository, then install dependencies: 54 | 55 | ```bash 56 | npm run start 57 | ``` 58 | 59 |
60 | 61 |
62 | build dev bundle 63 | 64 | ```bash 65 | npm run build 66 | ``` 67 | 68 |
69 | 70 |
71 | start dev (no hot reload) 72 | 73 | 74 | *NOTE: ensure you built first before starting* 75 | 76 | ```bash 77 | npm run start 78 | ``` 79 | 80 |
81 | 82 | ## LICENSE 83 | 84 | The MIT License (MIT) 85 | 86 | Copyright (c) 2017 Erwan DATIN 87 | 88 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 89 | 90 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 91 | 92 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 93 | -------------------------------------------------------------------------------- /components/header/Header.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | // #region imports 4 | import Link from 'next/link'; 5 | import Router from 'next/router'; 6 | import { connect } from 'react-redux'; 7 | import { bindActionCreators } from 'redux'; 8 | import * as userAuthActions from '../../redux/modules/userAuth'; 9 | import Navbar from 'react-bootstrap/lib/Navbar'; 10 | import Nav from 'react-bootstrap/lib/Nav'; 11 | import NavItem from 'react-bootstrap/lib/NavItem'; 12 | // import NavDropdown from 'react-bootstrap/lib/NavDropdown'; 13 | // import MenuItem from 'react-bootstrap/lib/MenuItem'; 14 | import { PureComponent } from 'react'; 15 | // #endregion 16 | 17 | // #region flow types 18 | type Props = { 19 | // userAuth: 20 | isAuthenticated: boolean, 21 | disconnectUser: (...any) => any, 22 | 23 | ...any 24 | }; 25 | 26 | type State = any; 27 | // #endregion 28 | 29 | class Header extends PureComponent { 30 | // #region default props 31 | static defaultProps = { 32 | isAuthenticated: false 33 | }; 34 | 35 | // #region component lifecycle methods 36 | render() { 37 | const { 38 | isAuthenticated 39 | } = this.props; 40 | 41 | return ( 42 | 47 | 48 | 49 | 52 | react-redux-next-bootstrap starter 53 | 54 | 55 | 56 | 57 | 58 |