Giter Club home page Giter Club logo

react-hooks-introduction's Introduction

โ›”๏ธ Deprecated

This is the old version of The Road to React with React class components and without React Hooks. Check out the new The Road to React which teaches React Hooks.

The Road to learn React [Book]

Official repository for The Road to learn React. If you want to leave a review, please do it on Amazon or Goodreads.

Translations of the book into Leanpub

The Road to learn React is also available in other languages. Thanks for all translators for their awesome work!

Updates, Help and Support

Contribute

You can help to improve the book by opening Issues and Pull Requests (PR).

You can open up any PR that corrects spelling or explains a certain lesson with more detail. When writing such a technical book, you get fast blind on what needs more explanation and on what is already explained well.

In addition, you can open Issues when you run into problems. In order to make the fix for the Issue as easy as possible, please provide a couple of details such as error log, screenshot, which page of the book it happened, your node version (command line: node -v) and a link to your own repository. Not all of these details are mandatory, but most of them help to fix the Issue and to improve the book.

Thanks a lot for your help!

react-hooks-introduction's People

Contributors

greenkeeper[bot] avatar johnspraul avatar rwieruch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-hooks-introduction's Issues

useDataApi: Is it worth to add axios.CancelToken ?

Something like this?

 useEffect(() => {
    const cancelTokenSource = axios.CancelToken.source();

    const fetchData = async () => {
      dispatch({ type: 'FETCH_INIT' });

      try {
        const result = await await axios(url, {
            cancelToken: cancelTokenSource.token,
          });

        if (!axios.isCancel()) {
          dispatch({ type: 'FETCH_SUCCESS', payload: result.data });
        }
      } catch (error) {
        if (!axios.isCancel(error)) {
          dispatch({ type: 'FETCH_FAILURE' });
        }
      }
    };

    fetchData();

    return () => {
      cancelTokenSource.cancel();
    };
  }, [url]);

doesn't comply with react-hooks/exhaustive-deps eslint rule

Thanks for your blog post on data fetching with React Hooks. I'm learning React Hooks and found it helpful.

Dan Abramov recently released a react-hooks/exhaustive-deps eslint rule. So I added eslint-plugin-react-hooks to a fork of this repo and got the following errors:

$ npm run -s eslint

/opt/gh/react-hooks-introduction/src/customHook-example/index.js
  22:6  warning  React Hook useEffect has missing dependencies: 'onOffline' and 'onOnline'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

/opt/gh/react-hooks-introduction/src/useDataApiHook-example/index.js
  29:5  warning  React Hook useEffect has a missing dependency: 'fetchData'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

โœ– 2 problems (0 errors, 2 warnings)
  0 errors and 2 warnings potentially fixable with the `--fix` option.

I have come up with solutions in my own code, but am curious how others such as yourself would solve them.

An in-range update of use-data-api is breaking the build ๐Ÿšจ

The dependency use-data-api was updated from 1.0.0 to 1.0.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

use-data-api is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of react-scripts is breaking the build ๐Ÿšจ

The dependency react-scripts was updated from 3.0.0 to 3.0.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

react-scripts is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of react is breaking the build ๐Ÿšจ

There have been updates to the react monorepo:

    • The dependency react was updated from 16.7.0-alpha.2 to 16.7.0.
  • The dependency react-dom was updated from 16.7.0-alpha.2 to 16.7.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the react group definition.

react is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v16.7.0

React DOM

Scheduler (Experimental)

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

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.