Skip to content

Refactoring: Contexts for both filters and courses

Karl Thomsson requested to merge contextRefactoring into main
  • Since the courses prop was very wide spread in our code, this prop was separated into a course-context. To access courses now, one imports useCourses from the utils/hooks.js file. This hooks returns a constant with all the course data. Example: const courses = useCourses().
  • The same was done for the complex state that the filters provided. To access the filter state one can import useFilters from the utils/hooks.js file. This hook returns the filters and the dispatch function to modify the state. Example: const [filters, dispatch] = useFilters().
  • Changed an unused state to a constant.
  • Fixed the Next/Script warning that was introduced when adding Splitbee.
  • Added a utility function that checks if an object is empty. (Deep checks for undefined, empty and null).
  • All components does destructuring of props over props.{propname}.
  • The app now disables for all mobile devices, even in landscape mode.
Edited by Karl Thomsson

Merge request reports