chore(angular-react): Migrate UsersServices to React useUsers hook #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the Angular
UsersServicesto a React custom hook (useUsers) following the Angular to React migration playbook. The new hook provides equivalent functionality to the Angular service'sgetUsers()method.Changes:
useUsers.tswith a React custom hook that fetches users from JSONPlaceholder APIHttpClient+Observablepattern with nativefetch+ React state managementloading,error,usersstates and arefetchfunctiongetUsers()async function for non-component contextsAngular service preserved - the original
UsersServices.tswas not removed per playbook guidelines.Review & Testing Checklist for Human
Userinterface matches the actual JSONPlaceholder API response - the type was manually defined and should be validated against https://jsonplaceholder.typicode.com/usersNotes
This migration follows the Angular to React playbook. The React hook cannot be tested in the current Angular-only environment since React is not installed as a dependency.
Link to Devin run: https://app.devin.ai/sessions/1332f66f33e047ed90e7825500a62628
Requested by: @milind-cognition