Skip to content
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

Create hook for handling fetching sections and related errors #296

Open
ssciolla opened this issue Jan 10, 2022 · 0 comments
Open

Create hook for handling fetching sections and related errors #296

ssciolla opened this issue Jan 10, 2022 · 0 comments
Labels
enhancement New feature or request front end Involves changes to the React application or other client-related files

Comments

@ssciolla
Copy link
Contributor

There are at least three features using this pattern, and I agree that it could be refactored to be DRYer. A custom hook like useSections capturing the useEffect logic could be a solution, though it wouldn't handle the JSX repetition.

const [sections, sectionsLoading, sectionsError, reset] = useSections(course.id)

"For Future/Icebox: I feel that the L60-L78, can be extracted to as separate component and can be reused in features like where ever the sections list is needed."

Originally posted by @pushyamig in #270 (comment)

@ssciolla ssciolla added enhancement New feature or request front end Involves changes to the React application or other client-related files labels Jan 10, 2022
@ssciolla ssciolla changed the title Create hook for handing fetching sections and related errors Create hook for handling fetching sections and related errors Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request front end Involves changes to the React application or other client-related files
Projects
None yet
Development

No branches or pull requests

1 participant