krzysu / reactjs-shopping-cart

example of shopping cart implemented in react.js and redux.js
http://krzysu.github.io/reactjs-shopping-cart/
227 stars 182 forks source link

How to force the selected products from cart component info ? #1

Closed cAstraea closed 8 years ago

cAstraea commented 8 years ago

Hello , Trying to do some modifications to this to include a search and pagination with https://github.com/AdeleD/react-paginate but having some problems http://recordit.co/HXqQ20roh1

If I'm adding items to the cart and start a search the products lose the .added state which I guess it's expected ? I thought maybe to keep the state in localStorage and set the added state based on that but not sure how it would be possible?

What would be the best way to remember the added state between searches and paginated results ?

krzysu commented 8 years ago

Hi, what you can find in this repo is only a demo, for real applications you should use props (not component state) and keep state of your application in some other place (i.e. in store, see redux https://egghead.io/courses/getting-started-with-redux)