Code Monkey home page Code Monkey logo

react_crash_todo's Introduction

React Crash Course (TodoList)

This is the code for the crash course on YouTube

Quick Start

# Install dependencies
npm install

# Serve on localhost:3000
npm start

# Build for production
npm run build

react_crash_todo's People

Contributors

bradtraversy avatar ishitb avatar reinbeumer avatar wsand02 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  avatar  avatar  avatar  avatar  avatar  avatar

react_crash_todo's Issues

Login page

How can you make a login page in this code?

compile errors in app.js

After installing create-react-app, uuid, axios and react-router, I loaded the code in this repo and got a compile error in app.js. To fix the problem, I commented out the following:

import uuid from 'uuid';
res.data.id = uuid.v4(); in the addTodo method

Checkbox does not match the entered values

On start with provided data, checkboxes are all unchecked but some of items are completed.
IMO there should be :
checked={this.props.todo.completed}
in line 19 in TodoItems.jsx

State is being modified in this function

Hey,

First of all nice work with the videos on youtube. While watching your video I noticed that the markComplete function is mutating the original state.

markComplete = (id) => {

Can be easily spotted with this example:

const todos = [{
  id: 1, title: 'Learn React', completed: false
}, {
  id: 2, title: 'Mutate state', completed: false
}];

const newState = todos.map(todo => {
  if (todo.id === 2) {
    todo.completed = !todo.completed;
  }
  return todo;
});

Error when submitting the form

Error in react_crash_todo/src/components/AddTodo.js
Error appears after submitting the form.

"dependencies": {
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-scripts": "3.1.1"
}

Screen Shot 2019-09-09 at 14 48 57

import uuid from 'uuid'; not working!

Hello! Importing is not working for uuid. It says :

Failed to compile.
./src/App.js
Attempted import error: 'uuid' does not contain a default export (imported as 'uuid').

But this is working :
const uuid = require('uuid');

Why it is showing error?

Error when adding multiples todos (Getting id: 201) - Fixing

Hello Brad, first thanks for the great tutorial crash course, but the final code has some issues about the add new todo process. The new todos had same ids of '201', in my researchs i've found that this is a http code related. Searching in the comments i've found a fix from a user "David Ernest"
(His channel). The fix is listed below:

In App.js, at axios.post '.then' for appTodo change to this:

.then(res => {
      res.data.id = uuid();  //or uuid.v4()
      this.setState({ todos: [...this.state.todos, res.data] });
    }); 

This should make your code work because this manually overwriting the id property that comes back from the JSON Placeholder API, as the Youtube user said!

Hope this help!

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.