Code Monkey home page Code Monkey logo

google_nearby's Introduction

Google nearby

This project is created via create-react-app and is deployed at https://google-nearby.netlify.app/

Starting the app

Create .env file in root and insert below

REACT_APP_GOOGLE_KEY={API KEY HERE}

In the project directory, you can run the following to start locally:

yarn start

Notes

In regards to CSS decision of using CSS-in-JS pattern with styled-components.

  • Great developer experience - Tracking your components and styles is simple as they live in the same file as your components.
  • Can apply complex javascript logic instead of trying to deal with classNames.
  • Have mostly just worked with styled-components professionally and do not have time to ramp up to use best practices with other methodologies.

In regards to the google api, best practices seemed to be using their js-api-loader https://cloud.google.com/blog/products/maps-platform/loading-google-maps-platform-javascript-modern-web-applications.

This took the most time besides setting up the initial boilerplate as it was a new api I haven't used before and wanted to make sure I was using the correct way to consume the api.

Only real issue I had not solved is the type def for the refs as it won't accept both HTMLDivElement | google.maps.Map types and unfortunately had to type cast the ref as any in this case.

Considerations

File Structure - First thing to consider is seperating concerns and business logic of use case for any files. Before going into the reasoning on structure, as these are always subjective, I believe there is a need to not deeply nest components in the file structure. With components there are larger components seperated into dumb/smart components while smaller components that are commonly used through the app would be placed in ui. There are some folders that are not used that I used when creating the boiler plate such as utils. Depending on the whole scale of the project, the file structure can be very different component wise. Some apps can have as little as 2 routes while some have hundreds and the latter would be a situation where we can move routes into a seperate file structure for better dev experience and readability but in this case I thought it was overkill.

Formik: Besides being comfortable with it, I used it instead of regular react forms initially in case there was a case of getting values in and out of the form state. It's also simple enough to place a Field input component and have a cleaner form component. Also even though there is no use case in this exercise, formik pairs very well with a versatile library named yup for any type of form validation and it is used in many different industries.

styled-components: I am familiar with styling with this library and the reasoning behind picking styled components is the styles live with the components that you are using and it makes sense in terms of modular code.

google_nearby's People

Contributors

zhhjoseph avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.