Skip to content

Conversation

@ljsikuade
Copy link

No description provided.

}
//Getting requests, setting them in state. Getting reviews, setting them in state.
componentDidMount() {
if (!localStorage.getItem("requests")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like too much work reading a value from localStorage, setting in localStorage and then reading it again. Why not read it and if it is not set then just a an empty array locally, instead of writing it to localStorage and reading it back.

@@ -0,0 +1,24 @@
import React from "react";
//not sure I need the spread operator actually
function CurrentReviews({ reviews }, ...props) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure the spread operator helps here. you can either just use props object as a parameter or destructure it to extract all its values into own variables

return (
<main className="feed">
<ul>
{requests ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when there are no requests it would be better to store it as an empty array and check the length property of the array to check if there is no data

@dmitrigrabov
Copy link
Contributor

Good work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants