React App to show cast info for breaking bad.
This codebase was created to demonstrate a frontend application built with React, Typescript, and Redux Toolkit including read operations, routing and more.
It uses the following API to get all the data: https://breakingbadapi.com/
This app consists of two screens:
- List of all existing characters.
- Character detail with a random quote.
- Skeleton while loading data
- Manage data loading feedback and error management
- Ability to change the language between English and Spanish
- Responsive app
- Clean and Simple Material UI
- Redux State Management
- Tests
The root of the application is the src/components/App
component. The App component uses react-router's HashRouter to display the different pages. Each page is represented by a function component.
Some components include a .slice
file that contains the definition of its state and reducers, which might also be used by other components. These slice files follow the Redux Toolkit guidelines. Components connect to the state by using custom hooks.
This application is built following (as much as practicable) functional programming principles:
- Immutable Data
- No classes
- No let or var
- Use of monads (Option, Result)
- No side effects
The code avoids runtime type-related errors by using Typescript and decoders for data coming from the API.
Some components include a .test
file that contains unit tests.
This project uses prettier and eslint to enforce a consistent code syntax.
src/components
Contains all the functional components.src/components/Pages
Contains the components used by the router as pages.src/config
Contains configuration files.src/services
Contains the code that interacts with external systems (API requests).src/state
Contains redux related code.src/translations
Contains translation files.src/types
Contains type definitions alongside the code related to those types.src/utils
Contains utility functions.
- @hqoss/monads: for passing to the UI when data is loading or there has been an error using a single variable.
- @mui/material: for importing some simple React components.
- @reduxjs/toolkit: for Redux State Management.
- axios: provides an easy-to-use API in a compact package for most of your HTTP communication needs.
- decoders: Elegant and battle-tested validation library for type-safe input data for TypeScript
- i18next: translations
- react-router-dom: add routing to react apps
- typescript: strongly typed programming language that builds on JavaScript
This project was bootstrapped with Create React App, using the Redux and Redux Toolkit template.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.