reactjswebgeolocationfrontendbackend

In a React App, should the country-state-city package go into the backend or frontend?


The country-state-city package is heavy in size. Can someone list the precise size of the package?

Design 1:

Load the package in the frontend APP

Design 2:

Load the package in the backend APP and then have the frontend ping the backend to send the appropriate State/City list upon detecting a change to the Country/State?

Which is the correct design in such scenario?

The full APP will be for mobile as well as web browsers.


Solution

  • I tried to add country-state-city to my frontend and the production bundle size increased from 1.1 MB to 16.6 MB.

    So the approach to return the data from the backend looks much more useful.