Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Handlebars with React #41

Open
CodeWritingCow opened this issue Jun 28, 2019 · 4 comments
Open

Replace Handlebars with React #41

CodeWritingCow opened this issue Jun 28, 2019 · 4 comments

Comments

@CodeWritingCow
Copy link
Owner

CodeWritingCow commented Jun 28, 2019

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.

@jeffslofish
Copy link

I would like to help with this.

@jeffslofish
Copy link

jeffslofish commented Jul 8, 2019

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.

@CodeWritingCow
Copy link
Owner Author

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:

  • Your version uses Hooks, while react-base uses class components. What are the advantages of using Hooks?
  • 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.

@jeffslofish
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants