Open CodeWritingCow opened 5 years ago
I would like to help with this.
I made an initial react version here: https://github.com/jeffslofish/NYC-restaurant-inspection-records/tree/react (make you use the react branch), for your consideration. It has basic functionality but could definitely be improved. The UI is slightly different right now, but I believe that can be fixed.
It is fetching data from the server but I couldn't get my api token to work, so I am not using that. It does query the server based on restaurant name and borough though.
Hi @jeffslofish, thank you for offering to help! There's a git branch for this issue. Please see what we're working on at react-base. My colleague @omenwolf has converted most of the homepage into React. We're working on other parts of the website. It'd be great if you can help!
A couple comments:
fetchMyAPI
has the same functionality as search-controller.js, which runs server-side. Since the Socrata URL query string must include an API token to work, I think we should continue handling that functionality on the server. The token is less likely to be exposed to public view there.Hooks allow you to use only functional components which are simpler than class components.
I created pull request #46 which uses the existing react-base branch and adds search results to it.
I welcome any comments and suggestions.
As @omenwolf suggests, we can replace Handlebars.js with React, converting the website into a single-page application. The goal is to reduce server requests for site rendering.