From 09489063ed56a492c8336b65a69d82dee8677ad7 Mon Sep 17 00:00:00 2001 From: Anton Jernberg Date: Mon, 25 Oct 2021 11:28:04 +0200 Subject: [PATCH] Removes legacy code and updates Solutions document --- lab2/DO_NOT_README.md | 4 ++-- .../components/BackgroundColorPicker/BackgroundColorPicker.js | 2 +- lab2/src/components/List/List.js | 1 - lab3/DO_NOT_README.md | 4 ++-- lab3/src/components/List/List.js | 3 +-- lab3/src/components/SearchBar/SearchBar.js | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lab2/DO_NOT_README.md b/lab2/DO_NOT_README.md index ba5e578..c038f4e 100644 --- a/lab2/DO_NOT_README.md +++ b/lab2/DO_NOT_README.md @@ -34,7 +34,7 @@ I `List.js`: ```javascript render() { ... - {items.length > 0 && + { items.map((item, index) => (
  • {item.name}
  • )) @@ -60,7 +60,7 @@ I `List.js`: ```javascript render() { - const filteredItems = this.filterListItemsBySearchTerm(this.state.searchTerm); + const filteredItems = this.filterListItemsBySearchTerm(searchTerm); ... {filteredItems.length > 0 && filteredItems.map((item, index) => ( diff --git a/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js b/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js index 31606c4..7073ee5 100644 --- a/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js +++ b/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React from "react"; import colors from "./colors"; import "./BackgroundColorPicker.css"; diff --git a/lab2/src/components/List/List.js b/lab2/src/components/List/List.js index d813e00..a678423 100644 --- a/lab2/src/components/List/List.js +++ b/lab2/src/components/List/List.js @@ -1,5 +1,4 @@ import React, { useState } from "react"; -import PropTypes from "prop-types"; import SearchBar from "../SearchBar/SearchBar"; import "./List.css"; diff --git a/lab3/DO_NOT_README.md b/lab3/DO_NOT_README.md index 98ec732..ac223ff 100644 --- a/lab3/DO_NOT_README.md +++ b/lab3/DO_NOT_README.md @@ -18,7 +18,7 @@ I `userActions.js`: ```javascript .then((users) => { - dispatch({ + useDispatch({ type: USERS_RECEIVED, payload: users }) @@ -59,4 +59,4 @@ const users = useSelector((state) => state.users.all); ## Del 2 -Lösninsförslag till del två går att se genom att byta branch till `solutions`. Här finns även alla uppgifter till alla labbar lösta. +Lösningsförslag till del två går att se genom att byta branch till `solutions`. Här finns även alla uppgifter till alla labbar lösta. diff --git a/lab3/src/components/List/List.js b/lab3/src/components/List/List.js index f528562..48a6b00 100644 --- a/lab3/src/components/List/List.js +++ b/lab3/src/components/List/List.js @@ -1,6 +1,5 @@ import React, { useState } from "react"; import SearchBar from "../SearchBar/SearchBar"; -import { connect } from "react-redux"; import "./List.css"; @@ -33,7 +32,7 @@ const List = ({ title }) => {
    Empty list...
    ) : (