Brad-Cole / VotingApp

First React based App
0 stars 1 forks source link

Sort button doesnt refresh #1

Closed Brad-Cole closed 8 years ago

Brad-Cole commented 8 years ago

Sort button set up for the challenge on this app. Instructions were to do the following: "Add a “sort direction” button to the top of ProductList, above all the products. It should enable the user to toggle sorting products by ascending or descending."

All the relevant code is in the app.js file. I added a state to the top level component that toggles based on the button being pressed here: https://github.com/Xerxes25x/VotingApp/blob/master/app.js#L4

When the button is clicked it executes this code: https://github.com/Xerxes25x/VotingApp/blob/master/app.js#L12

added an if/else statement to the sorting procedure based on the new state here: https://github.com/Xerxes25x/VotingApp/blob/master/app.js#L23-L31

The button itself is here: https://github.com/Xerxes25x/VotingApp/blob/master/app.js#L77

The feature does work, however when the button is clicked the lower level components don't refresh when you hit the sort button. They only change if you update some data, like changing a vote number.

cj-taylor commented 8 years ago

@Xerxes25x looking through this now. Hope to have some feedback/input for you soon.

Brad-Cole commented 8 years ago

Issue solved. Thanks for taking the time to help with it CJ.