turingschool-projects / lookingForFrontEnd

A job search app built with React
https://looking-for.herokuapp.com/
5 stars 5 forks source link

[WIP] Favorites index #95

Open zackforbing opened 8 years ago

zackforbing commented 8 years ago

DO NOT MERGE

wasn't able to get this functional. currently, this branch of the app returns no jobs, and throws a Warning: setState error:

Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.

I'm guessing this is because I'm passing getFavoriteJobs into the SearchBar component, as this.setState is part of that function. In my eyes, there are a few possibilities:

  1. the getFavoriteJobs function is not feasible, and: a. a multi-parameter endpoint needs to be created for a multi-record API call or b. we can iterate through localStorage.favoriteJobs and make a singular API call to fetch each favorited job
  2. the function is workable, but I am doing something wrong with setState

there could be more possible solutions than what I've laid out here.

for future mods:

this PR is the end of what i was able to do to produce a view of Favorited jobs. the functionality for adding favorites is implemented, and the favorited jobs are stored inside localStorage.favoriteJobs. one of the above methods (or another entirely) will need to be implemented for this functionality to be considered complete, and I think it's a worthwhile addition to the app.