-
Notifications
You must be signed in to change notification settings - Fork 11
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
Issue#24: Add a select form component for list of countries with autocomplete. #28
base: dev
Are you sure you want to change the base?
Conversation
package.json
Outdated
@@ -25,6 +26,7 @@ | |||
"react-router-dom": "^5.1.2", | |||
"react-scripts": "^3.4.1", | |||
"react-select": "^3.1.0", | |||
"react-select-country-list": "^2.1.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not keep this as a dependency. Only the essentials used in every single app should be in this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually these types of data regarding the list of counties usually come from a BE service and we fetch them once while bootstrapping the application and store them in redux store. Not sure why we need the list of countries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we want to have the list of countries in FE then, its usually saved it in a JSON and then the file is lazily loaded. (as the content can be upto 4 to 5KB in size)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not keep this as a dependency. Only the essentials used in every single app should be in this repo.
Okay dai I've removed this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually these types of data regarding the list of counties usually come from a BE service and we fetch them once while bootstrapping the application and store them in redux store. Not sure why we need the list of countries.
Thanks dai Got it
* | ||
* @param props | ||
*/ | ||
const CountrySelector = props => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a generic CountrySelector
, create a generic Select
component that accepts data as a prop so that it can be used for multiple select components.
Basically it should be an abstraction over React Select
.
Think of it this way, if we ever need to replace React Select
with another library, only this particular file should have modifications while our entire app should work with the same Select
component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@NadeemShakya Also a side note. Use |
82855e4
to
b51b127
Compare
…complete. - [x] Add `CountrySelector` component which gives a select form with list of all the country names with autocomplete functionality - [x] Uses `react-select` component with `react-select-country-list`
Description
The select form contains a generic list of the country names.
This PR resolves#24
Summary of changes
CountrySelector
component which gives a select form with list of all the country names with autocomplete functionalityreact-select
component withreact-select-country-list