react_on_rails 1.2.2 → 2.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. metadata +5 -126
  3. data/.babelrc +0 -3
  4. data/.coveralls.yml +0 -1
  5. data/.dockerignore +0 -2
  6. data/.eslintignore +0 -5
  7. data/.eslintrc +0 -48
  8. data/.gitignore +0 -26
  9. data/.jscsrc +0 -26
  10. data/.rspec +0 -2
  11. data/.rubocop.yml +0 -70
  12. data/.scss-lint.yml +0 -205
  13. data/.travis.yml +0 -41
  14. data/CHANGELOG.md +0 -42
  15. data/Dockerfile_tests +0 -12
  16. data/Gemfile +0 -38
  17. data/README.md +0 -363
  18. data/Rakefile +0 -5
  19. data/app/assets/javascripts/react_on_rails.js +0 -241
  20. data/app/helpers/react_on_rails_helper.rb +0 -224
  21. data/docker-compose.yml +0 -11
  22. data/docs/LICENSE +0 -21
  23. data/docs/additional_reading/heroku_deployment.md +0 -23
  24. data/docs/additional_reading/manual_installation.md +0 -142
  25. data/docs/additional_reading/node_dependencies_and_npm.md +0 -29
  26. data/docs/additional_reading/optional_configuration.md +0 -34
  27. data/docs/additional_reading/react-and-redux.md +0 -36
  28. data/docs/additional_reading/react_router.md +0 -45
  29. data/docs/additional_reading/server_rendering_tips.md +0 -16
  30. data/docs/additional_reading/tips.md +0 -10
  31. data/docs/additional_reading/webpack.md +0 -46
  32. data/docs/code_of_conduct.md +0 -13
  33. data/docs/coding-style/linters.md +0 -64
  34. data/docs/coding-style/style.md +0 -42
  35. data/docs/contributing.md +0 -62
  36. data/docs/generator_testing.md +0 -20
  37. data/docs/install_and_releasing.md +0 -24
  38. data/docs/sample_generated_js/README.md +0 -4
  39. data/docs/sample_generated_js/client-generated.js +0 -12
  40. data/docs/sample_generated_js/server-generated.js +0 -25
  41. data/lib/generators/USAGE +0 -99
  42. data/lib/generators/react_on_rails/base_generator.rb +0 -198
  43. data/lib/generators/react_on_rails/bootstrap_generator.rb +0 -91
  44. data/lib/generators/react_on_rails/dev_tests_generator.rb +0 -30
  45. data/lib/generators/react_on_rails/generator_errors.rb +0 -15
  46. data/lib/generators/react_on_rails/generator_helper.rb +0 -58
  47. data/lib/generators/react_on_rails/heroku_deployment_generator.rb +0 -30
  48. data/lib/generators/react_on_rails/install_generator.rb +0 -111
  49. data/lib/generators/react_on_rails/js_linters_generator.rb +0 -19
  50. data/lib/generators/react_on_rails/react_no_redux_generator.rb +0 -41
  51. data/lib/generators/react_on_rails/react_with_redux_generator.rb +0 -52
  52. data/lib/generators/react_on_rails/ruby_linters_generator.rb +0 -33
  53. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +0 -4
  54. data/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md +0 -16
  55. data/lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb +0 -5
  56. data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +0 -5
  57. data/lib/generators/react_on_rails/templates/base/base/client/.babelrc +0 -3
  58. data/lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md +0 -3
  59. data/lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/startup/globals.jsx.tt +0 -5
  60. data/lib/generators/react_on_rails/templates/base/base/client/index.jade +0 -15
  61. data/lib/generators/react_on_rails/templates/base/base/client/npm-shrinkwrap.json +0 -2907
  62. data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +0 -98
  63. data/lib/generators/react_on_rails/templates/base/base/client/server.js +0 -64
  64. data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.base.config.js.tt +0 -67
  65. data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.hot.config.js.tt +0 -67
  66. data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js +0 -41
  67. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +0 -28
  68. data/lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake.tt +0 -26
  69. data/lib/generators/react_on_rails/templates/base/base/lib/tasks/linters.rake.tt +0 -88
  70. data/lib/generators/react_on_rails/templates/base/base/package.json +0 -31
  71. data/lib/generators/react_on_rails/templates/base/server_rendering/client/app/bundles/HelloWorld/startup/serverGlobals.jsx +0 -3
  72. data/lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js +0 -40
  73. data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss +0 -63
  74. data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_post-bootstrap.scss +0 -10
  75. data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss +0 -8
  76. data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_react-on-rails-sass-helper.scss +0 -19
  77. data/lib/generators/react_on_rails/templates/bootstrap/client/bootstrap-sass.config.js +0 -89
  78. data/lib/generators/react_on_rails/templates/dev_tests/.rspec +0 -2
  79. data/lib/generators/react_on_rails/templates/dev_tests/spec/features/hello_world_spec.rb +0 -25
  80. data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +0 -57
  81. data/lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb +0 -21
  82. data/lib/generators/react_on_rails/templates/dev_tests/spec/spec_helper.rb +0 -95
  83. data/lib/generators/react_on_rails/templates/heroku_deployment/.buildpacks +0 -2
  84. data/lib/generators/react_on_rails/templates/heroku_deployment/Procfile +0 -1
  85. data/lib/generators/react_on_rails/templates/heroku_deployment/config/puma.rb +0 -15
  86. data/lib/generators/react_on_rails/templates/js_linters/client/.eslintignore +0 -1
  87. data/lib/generators/react_on_rails/templates/js_linters/client/.eslintrc +0 -48
  88. data/lib/generators/react_on_rails/templates/js_linters/client/.jscsrc +0 -18
  89. data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +0 -39
  90. data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +0 -33
  91. data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +0 -12
  92. data/lib/generators/react_on_rails/templates/no_redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +0 -11
  93. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx +0 -8
  94. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +0 -48
  95. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx +0 -8
  96. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +0 -43
  97. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx +0 -21
  98. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/index.jsx +0 -14
  99. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +0 -21
  100. data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx +0 -35
  101. data/lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js +0 -20
  102. data/lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +0 -21
  103. data/lib/generators/react_on_rails/templates/ruby_linters/.rubocop.yml +0 -26
  104. data/lib/generators/react_on_rails/templates/ruby_linters/.scss-lint.yml +0 -205
  105. data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/brakeman.rake +0 -17
  106. data/lib/generators/react_on_rails/templates/ruby_linters/lib/tasks/ci.rake +0 -33
  107. data/lib/generators/react_on_rails/templates/ruby_linters/ruby-lint.yml +0 -20
  108. data/lib/react_on_rails.rb +0 -6
  109. data/lib/react_on_rails/configuration.rb +0 -53
  110. data/lib/react_on_rails/engine.rb +0 -7
  111. data/lib/react_on_rails/prerender_error.rb +0 -31
  112. data/lib/react_on_rails/server_rendering_pool.rb +0 -111
  113. data/lib/react_on_rails/version.rb +0 -3
  114. data/rakelib/docker.rake +0 -33
  115. data/rakelib/dummy_apps.rake +0 -29
  116. data/rakelib/example_type.rb +0 -160
  117. data/rakelib/examples.rake +0 -103
  118. data/rakelib/examples_config.yml +0 -19
  119. data/rakelib/lint.rake +0 -37
  120. data/rakelib/run_rspec.rake +0 -65
  121. data/rakelib/task_helpers.rb +0 -44
  122. data/react_on_rails.gemspec +0 -31
  123. data/ruby-lint.yml +0 -24
@@ -1,2 +0,0 @@
1
- https://github.com/heroku/heroku-buildpack-nodejs.git
2
- https://github.com/heroku/heroku-buildpack-ruby.git
@@ -1 +0,0 @@
1
- web: bundle exec puma -C config/puma.rb
@@ -1,15 +0,0 @@
1
- workers Integer(ENV["WEB_CONCURRENCY"] || 2)
2
- threads_count = Integer(ENV["MAX_THREADS"] || 5)
3
- threads threads_count, threads_count
4
-
5
- preload_app!
6
-
7
- rackup DefaultRackup
8
- port ENV["PORT"] || 3000
9
- environment ENV["RACK_ENV"] || "development"
10
-
11
- on_worker_boot do
12
- # Worker specific setup for Rails 4.1+
13
- # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
14
- ActiveRecord::Base.establish_connection
15
- end
@@ -1,48 +0,0 @@
1
- ---
2
- parser: babel-eslint
3
-
4
- extends: eslint-config-airbnb
5
-
6
- plugins:
7
- - react
8
-
9
- globals:
10
- __DEBUG_SERVER_ERRORS__: true
11
- __SERVER_ERRORS__: true
12
-
13
- env:
14
- browser: true
15
- node: true
16
- mocha: true
17
-
18
- rules:
19
- ### Variables
20
- no-undef: 2
21
- no-unused-vars: [2, { vars: all, args: none }]
22
-
23
- ### Stylistic issues
24
- indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
25
- id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]
26
-
27
- ### React
28
- jsx-quotes: [1, prefer-double]
29
- react/display-name: 0
30
- react/jsx-boolean-value: [1, always]
31
- react/jsx-curly-spacing: [1, never]
32
- react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
33
- react/jsx-no-undef: 2
34
- react/jsx-sort-prop-types: 0
35
- react/jsx-sort-props: 0
36
- react/jsx-uses-react: 2
37
- react/jsx-uses-vars: 2
38
- react/no-danger: 0
39
- react/no-did-mount-set-state: 1
40
- react/no-did-update-set-state: 0
41
- react/no-multi-comp: 2
42
- react/no-unknown-property: 2
43
- react/prop-types: 1
44
- react/react-in-jsx-scope: 2
45
- react/require-extension: [1, { extensions: [.js, .jsx] }]
46
- react/self-closing-comp: 2
47
- react/sort-comp: 0 # Should be 1. `statics` should be on top.
48
- react/wrap-multilines: 2
@@ -1,18 +0,0 @@
1
- {
2
- "preset": "airbnb",
3
- "fileExtensions": [
4
- ".js",
5
- ".jsx"
6
- ],
7
- "excludeFiles": [
8
- "assets/**",
9
- "build/**",
10
- "node_modules/**"
11
- ],
12
- "esprima": "babel-jscs",
13
- "validateQuoteMarks": {
14
- "mark": "'",
15
- "escape": true,
16
- "ignoreJSX": true
17
- }
18
- }
@@ -1,39 +0,0 @@
1
- import React, { PropTypes } from 'react';
2
- import _ from 'lodash';
3
-
4
- // Simple example of a React "dumb" component
5
- export default class HelloWorldWidget extends React.Component {
6
- constructor(props, context) {
7
- super(props, context);
8
-
9
- // Uses lodash to bind all methods to the context of the object instance, otherwise
10
- // the methods defined here would not refer to the component's class, not the component
11
- // instance itself.
12
- _.bindAll(this, '_handleChange');
13
- }
14
-
15
- static propTypes = {
16
- name: PropTypes.string.isRequired,
17
- _updateName: PropTypes.func.isRequired,
18
- };
19
-
20
- // React will automatically provide us with the event `e`
21
- _handleChange(e) {
22
- const name = e.target.value;
23
- this.props._updateName(name);
24
- }
25
-
26
- render() {
27
- return (
28
- <div>
29
- <h3>
30
- Hello, {this.props.name}!
31
- </h3>
32
- <p>
33
- Say hello to:
34
- <input type="text" value={this.props.name} onChange={this._handleChange} />
35
- </p>
36
- </div>
37
- );
38
- }
39
- }
@@ -1,33 +0,0 @@
1
- import React, { PropTypes } from 'react';
2
- import HelloWorldWidget from '../components/HelloWorldWidget';
3
- import _ from 'lodash';
4
-
5
- // Simple example of a React "smart" component
6
- export default class HelloWorld extends React.Component {
7
- constructor(props, context) {
8
- super(props, context);
9
-
10
- // Uses lodash to bind all methods to the context of the object instance, otherwise
11
- // the methods defined here would not refer to the component's class, not the component
12
- // instance itself.
13
- _.bindAll(this, '_updateName');
14
- }
15
-
16
- static propTypes = {
17
- name: PropTypes.string.isRequired, // this is passed from the Rails view
18
- }
19
-
20
- state = {name: this.props.name} // how to set initial state in es2015 class syntax
21
-
22
- _updateName(name) {
23
- this.setState({name: name});
24
- }
25
-
26
- render() {
27
- return (
28
- <div>
29
- <HelloWorldWidget name={this.state.name} _updateName={this._updateName} />
30
- </div>
31
- );
32
- }
33
- }
@@ -1,12 +0,0 @@
1
- <%- component_name = options.server_rendering? ? "HelloWorldAppClient" : "HelloWorldApp" -%>
2
- import React from 'react';
3
- import HelloWorld from '../containers/HelloWorld';
4
-
5
- const <%= component_name %> = props => {
6
- const reactComponent = (
7
- <HelloWorld {...props} />
8
- );
9
- return reactComponent;
10
- };
11
-
12
- export default <%= component_name %>;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import HelloWorld from '../containers/HelloWorld';
3
-
4
- const HelloWorldAppServer = props => {
5
- const reactComponent = (
6
- <HelloWorld {...props} />
7
- );
8
- return reactComponent;
9
- };
10
-
11
- export default HelloWorldAppServer;
@@ -1,8 +0,0 @@
1
- import * as actionTypes from '../constants/helloWorldConstants';
2
-
3
- export function updateName(name) {
4
- return {
5
- type: actionTypes.HELLO_WORLD_NAME_UPDATE,
6
- name,
7
- };
8
- }
@@ -1,48 +0,0 @@
1
- // HelloWorldWidget is an arbitrary name for any "dumb" component. We do not recommend suffixing all your
2
- // dump component names with Widget.
3
-
4
- import React, { PropTypes } from 'react';
5
- import Immutable from 'immutable';
6
- import _ from 'lodash';
7
-
8
- // Simple example of a React "dumb" component
9
- export default class HelloWorldWidget extends React.Component {
10
- constructor(props, context) {
11
- super(props, context);
12
-
13
- // Uses lodash to bind all methods to the context of the object instance, otherwise
14
- // the methods defined here would not refer to the component's class, not the component
15
- // instance itself.
16
- _.bindAll(this, '_handleChange');
17
- }
18
-
19
- static propTypes = {
20
- // We prefix all property and variable names pointing to Immutable.js objects with '$$'.
21
- // This allows us to immediately know we don't call $$helloWorldStore['someProperty'], but instead use
22
- // the Immutable.js `get` API for Immutable.Map
23
- actions: PropTypes.object.isRequired,
24
- $$helloWorldStore: PropTypes.instanceOf(Immutable.Map).isRequired,
25
- }
26
-
27
- // React will automatically provide us with the event `e`
28
- _handleChange(e) {
29
- const name = e.target.value;
30
- this.props.actions.updateName(name);
31
- }
32
-
33
- render() {
34
- const $$helloWorldStore = this.props.$$helloWorldStore;
35
- const name = $$helloWorldStore.get('name');
36
- return (
37
- <div>
38
- <h3>
39
- Hello, {name}!
40
- </h3>
41
- <p>
42
- Say hello to:
43
- <input type="text" value={name} onChange={this._handleChange} />
44
- </p>
45
- </div>
46
- );
47
- }
48
- }
@@ -1,8 +0,0 @@
1
- // See https://www.npmjs.com/package/mirror-creator
2
- // Allows us to easily setup constants inside of
3
- // client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx
4
- import mirrorCreator from 'mirror-creator';
5
-
6
- export default mirrorCreator([
7
- 'HELLO_WORLD_NAME_UPDATE',
8
- ]);
@@ -1,43 +0,0 @@
1
- import React, { PropTypes } from 'react';
2
- import HelloWorldWidget from '../components/HelloWorldWidget';
3
- import { connect } from 'react-redux';
4
- import { bindActionCreators } from 'redux';
5
- import Immutable from 'immutable';
6
- import * as helloWorldActionCreators from '../actions/helloWorldActionCreators';
7
-
8
- function select(state) {
9
- // Which part of the Redux global state does our component want to receive as props?
10
- // Note the use of `$$` to prefix the property name because the value is of type Immutable.js
11
- return { $$helloWorldStore: state.$$helloWorldStore };
12
- }
13
-
14
- // Simple example of a React "smart" component
15
- class HelloWorld extends React.Component {
16
- constructor(props, context) {
17
- super(props, context);
18
- }
19
-
20
- static propTypes = {
21
- dispatch: PropTypes.func.isRequired,
22
-
23
- // This corresponds to the value used in function select above.
24
- $$helloWorldStore: PropTypes.instanceOf(Immutable.Map).isRequired,
25
- }
26
-
27
- render() {
28
- const { dispatch, $$helloWorldStore } = this.props;
29
- const actions = bindActionCreators(helloWorldActionCreators, dispatch);
30
-
31
- // This uses the ES2015 spread operator to pass properties as it is more DRY
32
- // This is equivalent to:
33
- // <HelloWorldWidget $$helloWorldStore={$$helloWorldStore} actions={actions} />
34
- return (
35
- <HelloWorldWidget {...{$$helloWorldStore, actions}} />
36
- );
37
- }
38
- }
39
-
40
- // Don't forget to actually use connect!
41
- // Note that we don't export HelloWorld, but the redux "connected" version of it.
42
- // See https://github.com/rackt/react-redux/blob/master/docs/api.md#examples
43
- export default connect(select)(HelloWorld);
@@ -1,21 +0,0 @@
1
- import Immutable from 'immutable';
2
-
3
- import * as actionTypes from '../constants/helloWorldConstants';
4
-
5
- export const $$initialState = Immutable.fromJS({
6
- name: '', // this is the default state that would be used if one were not passed into the store
7
- });
8
-
9
- export default function helloWorldReducer($$state = $$initialState, action) {
10
- const { type, name } = action;
11
-
12
- switch (type) {
13
- case actionTypes.HELLO_WORLD_NAME_UPDATE: {
14
- return $$state.set('name', name);
15
- }
16
-
17
- default: {
18
- return $$state;
19
- }
20
- }
21
- }
@@ -1,14 +0,0 @@
1
- // This file is our manifest of all reducers for the app.
2
- // See also /client/app/bundles/HelloWorld/store/helloWorldStore.jsx
3
- // A real world app will likely have many reducers and it helps to organize them in one file.
4
- // `https://github.com/shakacode/react_on_rails/tree/master/docs/additional_reading/generated_client_code.md`
5
- import helloWorldReducer from './helloWorldReducer';
6
- import { $$initialState as $$helloWorldState } from './helloWorldReducer';
7
-
8
- export default {
9
- $$helloWorldStore: helloWorldReducer,
10
- };
11
-
12
- export const initalStates = {
13
- $$helloWorldState,
14
- };
@@ -1,21 +0,0 @@
1
- <%- generator_function_name = options.server_rendering? ? "HelloWorldAppClient" : "HelloWorldApp" -%>
2
- import React from 'react';
3
- import { Provider } from 'react-redux';
4
-
5
- import createStore from '../store/helloWorldStore';
6
- import HelloWorld from '../containers/HelloWorld';
7
-
8
- // See documentation for https://github.com/rackt/react-redux.
9
- // This is how you get props from the Rails view into the redux store.
10
- // This code here binds your smart component to the redux store.
11
- const <%= generator_function_name %> = props => {
12
- const store = createStore(props);
13
- const reactComponent = (
14
- <Provider store={store}>
15
- <HelloWorld />
16
- </Provider>
17
- );
18
- return reactComponent;
19
- };
20
-
21
- export default <%= generator_function_name %>;
@@ -1,35 +0,0 @@
1
- import { compose, createStore, applyMiddleware, combineReducers } from 'redux';
2
-
3
- // See https://github.com/gaearon/redux-thunk and http://redux.js.org/docs/advanced/AsyncActions.html
4
- // This is not actually used for this simple example, but you'd probably want to use this once your app has
5
- // asynchronous actions.
6
- import thunkMiddleware from 'redux-thunk';
7
-
8
- // This provides an example of logging redux actions to the console.
9
- // You'd want to disable this for production.
10
- import loggerMiddleware from 'lib/middlewares/loggerMiddleware';
11
-
12
- import reducers from '../reducers';
13
- import { initalStates } from '../reducers';
14
-
15
- export default props => {
16
- // This is how we get initial props Rails into redux.
17
- const { name } = props;
18
- const { $$helloWorldState } = initalStates;
19
-
20
- // Redux expects to initialize the store using an Object, not an Immutable.Map
21
- const initialState = {
22
- $$helloWorldStore: $$helloWorldState.merge({
23
- name: name,
24
- }),
25
- };
26
-
27
- const reducer = combineReducers(reducers);
28
- const composedStore = compose(
29
- applyMiddleware(thunkMiddleware, loggerMiddleware)
30
- );
31
- const storeCreator = composedStore(createStore);
32
- const store = storeCreator(reducer, initialState);
33
-
34
- return store;
35
- };
@@ -1,20 +0,0 @@
1
- /* eslint no-console: 0 */
2
-
3
- // This logger should be configured not to run in a production environment.
4
- // See https://github.com/petehunt/webpack-howto#6-feature-flags for you might turn this off for production.
5
- export default function logger({ getState }) {
6
- return next => action => {
7
- console.log('will dispatch', action);
8
-
9
- // Call the next dispatch method in the middleware chain.
10
- const result = next(action);
11
-
12
- const immutableState = getState();
13
-
14
- console.log('state after dispatch', JSON.stringify(immutableState));
15
-
16
- // This will likely be the action itself, unless
17
- // a middleware further in chain changed it.
18
- return result;
19
- };
20
- }
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { Provider } from 'react-redux';
3
-
4
- import createStore from '../store/helloWorldStore';
5
- import HelloWorld from '../containers/HelloWorld';
6
-
7
- // See documentation for https://github.com/rackt/react-redux.
8
- // This is how you get props from the Rails view into the redux store.
9
- // This code here binds your smart component to the redux store.
10
- // This is how the server redux gets hydrated with data.
11
- const HelloWorldAppServer = props => {
12
- const store = createStore(props);
13
- const reactComponent = (
14
- <Provider store={store}>
15
- <HelloWorld />
16
- </Provider>
17
- );
18
- return reactComponent;
19
- };
20
-
21
- export default HelloWorldAppServer;