Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add React Redux to Examples #2198

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/bower_components
/dist
/tooling/node_modules
cypress/screenshots
/cypress/screenshots
/cypress/videos
/.tmp
.DS_Store
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ jobs:
env:
- CYPRESS_framework=react-backbone
<<: *defaults
- stage: test
env:
- CYPRESS_framework=react-redux
<<: *defaults
- stage: test
env:
- CYPRESS_framework=reagent
Expand Down
3 changes: 3 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
<<: *defaults
react:
<<: *defaults
react-redux:
<<: *defaults
vue:
<<: *defaults
angularjs:
Expand Down Expand Up @@ -150,6 +152,7 @@ workflows:
- backbone
- dojo
- react
- react-redux
- vue
- angularjs
- knockback
Expand Down
17 changes: 17 additions & 0 deletions examples/react-redux/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"jest": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"settings": {
"react": {
"version": "16.14.0"
}
},
"rules": {
"no-extra-parens": 0,
"react/prop-types": 0,
"react/react-in-jsx-scope": 0
// "react/jsx-max-props-per-line": [1, { "maximum": 2 }]
}
}
2 changes: 2 additions & 0 deletions examples/react-redux/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
/node_modules
51 changes: 51 additions & 0 deletions examples/react-redux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# TodoMVC: React-Redux

## Description

This application uses React in combination with Redux to implement a todo application.
flashdesignory marked this conversation as resolved.
Show resolved Hide resolved

- [React](https://reactjs.org/) is a JavaScript library for creating user interfaces.
- [Redux](https://redux.js.org/) centralizes your application's state.
- [React-Redux](https://react-redux.js.org/) is designed to work with React's component model.

## Implementation details

This implementation uses Redux to manage state and data flow of the application.
The Redux pattern is similar to a mvc patter, with the main difference that Redux is unidirectional.
flashdesignory marked this conversation as resolved.
Show resolved Hide resolved
Redux uses actions to dispatch a change, which is captured by reducers that update a central store.
Once the state in the store updates, the view receives the new state and can reflect those changes to the user.

Redux:\
Model: Redux store\
View: React ui components\
controller: React connected components + Redux reducers
flashdesignory marked this conversation as resolved.
Show resolved Hide resolved

MVC:\
Model: maintains the data and behavior of an application\
View: displays the model in the ui\
Controller: serves as an interface between view & model components

The storage solution uses an in-memory data object that implements a simple array to hold the todos.

## Built steps
flashdesignory marked this conversation as resolved.
Show resolved Hide resolved

To build the static files, this application utilizes webpack. It minifies and optimizes output files and copies all necessary files to a `dist` folder.

## Requirements

The only requirement is an installation of Node, to be able to install dependencies and run scripts to serve a local server.

```
* Node (min version: 18.13.0)
* NPM (min version: 8.19.3)
```

## Local preview

```
terminal:
1. npm install
2. npm run dev
browser:
1. http://localhost:7001/
```
7 changes: 7 additions & 0 deletions examples/react-redux/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is used for Jest to function properly.
module.exports = {
presets: [
["@babel/preset-env", { targets: "defaults" }],
["@babel/preset-react", { runtime: "automatic" }],
],
};
3 changes: 3 additions & 0 deletions examples/react-redux/dist/app.bundle.js

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions examples/react-redux/dist/app.bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/

/** @license React v0.19.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.14.0
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.14.0
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.14.0
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
1 change: 1 addition & 0 deletions examples/react-redux/dist/app.bundle.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions examples/react-redux/dist/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading