Giter Site home page Giter Site logo

react-18-typescript's Introduction

React v18 TypeScript

A simple template to start your new React v18 TypeScript project. It includes some of the most used features for a React TypeScript initial project.

Features

  • React v18 TypeScript
  • React Router DOM
  • ESLint
  • Styled Components
  • Recoil
  • Jest
  • Cypress
  • Husky
  • Webpack
  • Babel
  • GitHub Actions

How to use

Just click in Use this template in order to start your new project with this code.

Install dependencies

After that, change directory into the project:

cd react-18-typescript/

and run

yarn

in order to install packages dependencies.


Husky

Run

yarn prepare

in order to install Husky. And, if the hooks don't work, you have to make them executable by running

chmod +x ./husky/pre-commit
# and
chmod +x ./husky/pre-push

or delete both of them and then run

npx husky add .husky/pre-commit "yarn lint-staged"
# and
npx husky add .husky/pre-push "yarn test:cov"

Running

To run the application in the development mode:

yarn start:dev

To run the application in the production mode:

yarn build
# and
yarn start

For Development the application will be available at https://localhost:3000/; Production mode will be at http://localhost:3000/.


Tree Hierarchy

It makes use of the concept of Clean Code Architecture in order to build a more reliable and maintainable application.

.
├── assets
│   └── images
├── components
│   └── Loading
├── pages
│   └── Home
│       ├── context
│       ├── types
│       ├── useCases
│       ├── viewModels
│       └── views
└── shared

This is just an example that I, personally, use. We divide the files as follows:

  • assets: as the name suggests, here lies all graphic data we may use in our application, like videos, images, svgs, gif...and so on.
  • components: we always think in terms of componentization. By this means, every single component (like a Loading one) we use in several places in our application, we should put it in here and reuse it throughout the code.
  • pages: usually every and each different route will have a different page. Therefore, we divide them into different folders. In this example, we have the Home page.
    • context: here we make use of React Context if the components in our page need to recall some state that lies in different components on the same page. This prevents us from cascading props.
    • types: every single type we use in our page, we put it all in here.
    • useCases: usually a useCase will have functions that communicate with our servers (like an HTTP request) or some complex objects maneuvers.
    • viewModels: in order for our view to not be static, it must have some definitions and actions, like updating it at some rate; onClick events; websocket events and others. Therefore, here lies all things needed to make the page (the view) dynamic.
    • views: only the UI must exist in this folder. It's only what the user will see, like HTML and CSS.
  • shared: every other element that is used by more than one page, subject or component must exist here.

react-18-typescript's People

Contributors

guilospanck avatar

Watchers

 avatar  avatar  avatar

Forkers

jitendra1604

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.