React
RE03

RE02 Exercises

Practical Exercises

  1. Write a TodoItem component (with a prop: {id: number}), that fetches one todo item from https://jsonplaceholder.typicode.com/todos/<id> (with the id being the property passed to this component) and displays this todo.

The type of the returned todo on this url is:

type Todo = {
  id: number;
  userId: number;
  title: string;
  completed: boolean
}
  1. Name a few common wrong use cases of the useEffect hook.