Giter Club home page Giter Club logo

react-effect-for-fetch's Introduction

React Effect with Fetch

Learning Objectives

  • Explain the method signature of React’s effect hook
  • Build a component with an effect hook that requests data from an API only on component mounting
  • Build a component that has a state and an effect hook
  • Build a component with an effect hook that watches for changes to a given value and triggers the effect
  • Build a component that is passed data via props with an effect hook that watches for changes to a props value

Set up

  1. Fork this repository
  2. Clone the forked repository onto your local machines
  3. In the root directory, type npm ci, which installs dependencies for the project
  4. Finally, type npm run dev, which starts a development server that runs your website in the browser.

Instructions

The aim of the exercise is to practice fetching data and rendering lists.

Your goal is to build an app which looks something like this:

In the sections folder you will find three sections (contained in sub-folders) to complete for this exercise. You have Art, Users and Advice.

Inside each sub-folder you will find:

  • an index.jsx file for the logic of each section build everything here and then break it down into components
  • a template.html that shows you an example of what your React components should create. Take note of className to get the styling working.
  • a components folder with suggested components to create so you can practice props.

For each section you will need to make a fetch request using the following APIs:

Core Deliverables

The Art list should render:

  • An image of the artwork
  • The title of the artwork
  • The artist's name
  • The complete publication history as an unordered list

The Users list should render:

  • A profile image
  • The full name of the user
  • The background colour of each list item should be set the the person's favourite colour
  • The email of the user

The Advice section is for the Extension only.

Extension 1

The Advice slip section should render:

  • A single random advice slip
  • A list of favourtie advice slips

The Advice slip section should allow users to:

  • Fetch another advice slip using a button
  • Save an advice slip to favourites using a button

react-effect-for-fetch's People

Contributors

dearshrewdwit avatar dependabot[bot] avatar julesnuggy avatar logi13 avatar mikemherron avatar stevenrico avatar vherus avatar

Watchers

 avatar

react-effect-for-fetch's Issues

Spelling errors in src/sections/Advice/index.jsx

The index.jsx in sections/Advice speaks of

  • className="adivce-slip" and
  • className="favourtite-slips-list",

meanwhile the empty placeholder files are named AdviceSlip.jsx and FavouriteSlipsList.jsx, so either it's a deliberate test to see who catches that or a spelling mistake.

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.