Giter Club home page Giter Club logo

ts-redux-react-realworld-example-app's Introduction

Netlify Status Pipeline

React codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with React, Typescript, and Redux Toolkit including CRUD operations, authentication, routing, pagination, and more.

For more information on how this works with other frontends/backends, head over to the RealWorld repo.

How it works

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 enforces a 100% code coverage.

This project uses prettier and eslint to enforce a consistent code syntax.

Folder structure

  • src/components Contains all the functional components.
  • src/components/Pages Contains the components used by the router as pages.
  • src/state Contains redux related code.
  • src/services Contains the code that interacts with external systems (API requests).
  • src/types Contains type definitions alongside the code related to those types.
  • src/config Contains configuration files.

Getting started

This project was bootstrapped with Create React App, using the Redux and Redux Toolkit template.

Available Scripts

In the project directory, you can run:

npm start

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.

Note: This project will run the app even if linting fails.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

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.

ts-redux-react-realworld-example-app's People

Contributors

angelguzmaning avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.