Giter Club home page Giter Club logo

dog-saga's Introduction

Dog Saga

or

Using Redux-Saga to Fetch Dog Pictures

This project was bootstrapped with Create React App and makes minimal use of regular Redux. Rather, it focuses on how the Saga pattern enhances Redux to make the app flow easier and simpler to control.

A Puppy! Source: Redux-Saga tutorial for beginners and dog lovers

Installing

Just download, npm install and npm start. The app will open on your browser and it's front-end only.

About Sagas

Saga is a pattern that has been around for quite some time. First proposed in 1987 by Hector Garcia-Molina and Kenneth Salem, it dealt at first exclusively with database transactions; more precisely, how to deal with long-lived transactions that you could not start and end in a very short time and thus guarantee them to be atomic.

The solution was to break large transactions down to smaller ones, and accept that they would come in a sequence. As soon as one of them failed, rather than revert the whole transaction at once (which at this point is understood is not possible anymore), each successfully completed transaction can be compensated, or undone, by a semantically equivalent one, that has the opposite effect.

Which brings us to...

Redux-Saga

Redux-Saga aims to manage the effect actions have when performed on the application. Redux by itself does a great job at managing state, but it can be cumbersome to fire several things that should happen from one action, either in sequence or at the same time, or following a certain interval. Enter the Saga pattern, which captures a regular Redux instruction and can do several things with it -- be it fetch some data, wait for the next call, or run some logic of its own.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test

Launches the test runner.
See the section about running tests for more information. Code coverage is always collected into src/coverage folder.

Known issues

  • MSW is not capturing network traffic, thus impairing some of the tests.

npm test:watch

Launches the test runner in the interactive watch mode.
Code coverage is always collected into src/coverage folder.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

npm run build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

dog-saga's People

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.