- In order to fulfill the task, I've used my favourite React + TypeScript setup.
- State management. Instead of using component's local state or one of the state managers, I've implemented React-Hook-Form, where management of the fields is out of the box. In this way I was able to capture all fields, and depends on fields state, handle the map and form behaviour.
- For Axios HTTP Request (POST only in this case), I've built a little bit of abstraction, where entire request handling is under the hood.
- Validation and fields error handling is handled by Yup, that provides defined schema used by React-Hook-Form at the end
- Mocking of back-end response is handled by MSW (Mock Service Worker), where depends on the coordinates validation, success or error message will be displayed.
- For proper repository managing and building, simple CI pipeline was configured
- To keep the project in good shape, and make it scalable, the bulletproof-react file structure was implemented
- Ladle is used here to build, render and mock UI.
Just fill the form fields, choose one of the files (AOI.txt or AOI_not_valid.txt) to test form behaviour.
- npm i - to install dependencies
- npm run ladle - to run mock environment using Ladle
- React
- TypeScript
- Axios
- Ladle (UI mock)
- Tanstack-query (API calls)
- React-Hook-Form (form hanling)
- yup (form validation)
- eslint / prettier (code quality)
- Vite (run engine)
- Jest (testing)
- MSW (Mocking adapter)
- Github Actions
- Bulletproof-react