Stuck on Recipe Box

Stuck on Recipe Box
0.0 0

#1

This is my project thus far: https://codepen.io/gphalen/pen/YLGjax

The best way I can think of to do this is to call localStorage after the user enters the “food” (line 52) and then push the localstorage into an array (line 15) which I then display in the JSX (line 117). The localStoragearray seems to regard all of the different “food” entries as a single index, so I have no idea how to do different click events for different “foods.” Also, doing JSON.parse in the JSX seems to make the whole page go blank at times, which may be another issue entirely.

I’m feeling really stuck here, any help is appreciated.


#2

If you’re looking for a general suggestion i would say to use the lifecyle hook “ComponentDidMount” to check the local storage, and just in case assign that value to your food array: when ( if ) assigned you can iterate through the resulting json and visualize the data^^