Skip to content

React TypeScript Application

Glen Sørbø edited this page Sep 5, 2022 · 7 revisions

React TypeScript

The frontend of the application is a React application written in TypeScript. The following are technologies that have been chosen for this project:

Styled Components

styled-components.com/

Styled components are a way of enhancing CSS styling of React Components. Some benefits of using styled components are:

  • Automatic critical CSS, which only injects the necessary CSS for a render.
  • Unique class name generation which eliminates the possibility of duplication.
  • Easier CSS management, with the CSS being located in the same place as it is being used.
  • Dynamic styling with props

Redux Toolkit

redux-toolkit.js.org/

The state of the application is handled by Redux which is a predictable state container for TypeScript applications. For ease of use the project uses the Redux Toolkit, which simplifies store setup, creating reducers, immutable update logic, and more.

Implementation

Redux is setup in src/hooks/useRedux.ts and the application is wrapped with the Provider in src/index.tsx using <Provider store={store}></Provider>.

This provides the application with the two state files auth.state.ts and map.state.ts found in src/store/state/ directory. The files provide an initial state, which is accessible via the useStateSelector method. The files also provide a structure for setter methods, which are accessible via useStateDispatch.

React Router

reactrouter.com

MapBox

Find Map Wiki for information about MapBox

Clone this wiki locally