Skip to content
This repository was archived by the owner on Mar 25, 2021. It is now read-only.

Latest commit

 

History

History
38 lines (28 loc) · 1.37 KB

README.md

File metadata and controls

38 lines (28 loc) · 1.37 KB

Hooks

This directory contains all re-usable custom React Hooks implemented for use across this UI. Unlike Models, these hooks encapsulate re-usable/common logic views or models may want to utilise, such as translation capabilities.

Test approach

Elements should be tested in a functional manor. See Test Driven Development.

Expected files

For a given Hook useFoo, the expected files are as follows:

Hooks/
  index.ts
  types.ts
  useFoo/
    README.md
    useFoo.ts
    useFoo.spec.ts
    useFoo.assets.ts
    useFoo.types.ts

Where:

  • index.ts acts as a barrel file, exporting the hooks defined in the Hooks directory
  • types.ts acts as a barrel file, exporting all the public types of each context
  • README.md is the readme for this hook, detailing design choices and usage
  • useFoo.ts is the hook implementation
  • useFoo.spec.ts are the tests for this hook
  • useFoo.assets.ts are the test assets for this hook
  • useFoo.types.ts are the types for this hook

Implemented hooks

  • useConfigFeatureFlag - a hook providing consumer access to the ConfigFeatureFlag context, containing configuration and feature flag state
  • useLogger - sends client log messages to the WebSocket listener on the server /log endpoint.