Refactoring codes
I think app.js is getting pretty long and will be hard to read for newcomers. Can we refactor this with some javascript structure standard that I'm not aware of?
I have made some basic changes to the App.js file to improve readability and separated some logic out to other files where possible. I think we will want to move the callSheets and normalizeHeaders functions to a separate file at some point, which would help clarify and shorten the app.js file.
I have been looking at how to handle state, perhaps we can use the React Context API instead of adding the overhead of Redux. I think the Map component could be a good candidate to handle its own state, and this would allow us to move several functions (onMouseEnter, onMouseLeave, possibly onOrganizationClick) out of App.js entirely. I am wary of moving the state management until I learn more about the best practices for state handling.
If anyone has an opinion on any of this please let me know. I will continue researching state management for now
Can you make a pull request with what you have? I want to refactor some components. I've separated the Header into smaller components so avoid the Header.js file to avoid merge conflicts.
Absolutely @Khoawala, I just made a pull request (#71 ) with what I have
The to do list is as follows for refactoring App.js
-
[x] Refactor JSX structures for readability
-
[x] Move callSheets logic to separate file
-
[x] Move normalizeHeaders logic to separate file
-
[x] Consolidate map related state handling and logic to exist in the Map component
-
[x] Move sorting and ResultList related state handling and logic to ResultList component
-
[ ] Move location related logic to utility file or Map component
-
[ ] Move components to individual folders