Skip to content
Projetos

Sobre

A framework for building React applications

Desenvolvimento web e de aplicativos

Como estes números são medidos

O que você pode fazer

  • Dependency injection
  • Immutable state management
  • Redux plug-in module
  • Test bed for unit testing and integration testing

Crescimento medido de estrelas

em 24 h
0
em 7 dias
0
em 15 dias
0
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

Reactant Logo


Node CI npm version license

Reactant - A framework for building React applications

Motivation

React is a JavaScript library for building user interfaces, but when we want to develop applications based on React, we often have to do a lot of building configuration and many other libraries choices(Picking and learning a React state library and router library, etc.). We also need to consider how our business logic should be abstracted and structured. Everyone who uses React practices their own perception of how React is built, but it doesn't allow us to quickly focus on the business logic itself. As the application business grows in size, we urgently need a framework that can be easily understood and maintained.

And for the structured design of the application's business logic, separation of concern is a good idea. It requires clear boundaries of liability to avoid low maintainability when UI logic and business logic are mixed. We always want to focus on business logic when building applications. It is one of the business core values of an application. We want it to be easy to maintain, and test. Redux remains most popular state library in React. It is fully accord with immutable principles for React. Redux is just a state container, and we're often at a loss for how to really manage those states. We need a framework for scalable, loosely coupled and easily maintainable React applications.


In order to solve these problems, Reactant was created. It's a framework for React.

Features

Q&A

  1. How does it differ from Angular?

It is different everywhere except for dependency injection.

  1. What is the biggest advantage of Reactant?

It can architect a variety of large React projects. Reactant advocates a lightweight UI, separating the concerns of the application and UI to greatly enhance the maintainability of the project.

Usage

pnpm dlx reactant-cli init my-app
cd my-app
pnpm start

Example


Reactant is very easy to get started. You can try Reactant by visiting the online demo.

Here is the counter example:

import React from 'react';
import {
  ViewModule,
  createApp,
  injectable,
  useConnector,
  action,
  state,
} from 'reactant';
import { render } from 'reactant-web';

@injectable()
class Counter {
  @state
  count = 0;

  @action
  increase() {
    this.count += 1;
  }
}

@injectable()
class AppView extends ViewModule {
  constructor(public counter: Counter) {
    super();
  }

  component() {
    const count = useConnector(() => this.counter.count);
    return (
      <button type="button" onClick={() => this.counter.increase()}>
        {count}
      </button>
    );
  }
}

const app = createApp({
  main: AppView,
  render,
});

app.bootstrap(document.getElementById('app'));

Packages

  • reactant
  • reactant-cli
  • reactant-di
  • reactant-last-action
  • reactant-model
  • reactant-module
  • reactant-native
  • reactant-redux
  • reactant-router
  • reactant-router-dom
  • reactant-router-native
  • reactant-share
  • reactant-ssr
  • reactant-storage
  • reactant-template
  • reactant-web

Documentation

You can visit reactant.js.org for more documentation.

License

Reactant is MIT licensed.

Contributing

Use Node.js 22.22.2+ (22.x) or 24.15+ and the pnpm version pinned in package.json. Install the workspace with pnpm install --frozen-lockfile. Run pnpm lint and pnpm format:check to check the source with Oxlint and Oxfmt. Use pnpm format to apply formatting. Stage the files for one change and run pnpm commit to compose a Conventional Commit with Commitizen.

Run pnpm changeset when a change affects a published package. The Reactant packages share a fixed version. Maintainers can inspect the release plan with pnpm changeset status and apply it with pnpm update:version. Commit the version changes and lockfile together. The GitHub release workflow builds and tests the workspace before running pnpm release.

pnpm test runs the development suite and the ES2015 inheritance tests. Use pnpm test:prod for production behavior, pnpm test:useDefineForClassFields for native class-field semantics and pnpm test:watch while editing.

pnpm typecheck checks the libraries, tests, examples and documentation site with TypeScript 7. pnpm build creates the package bundles with tsdown and emits declarations with the same compiler. The TypeDoc generators use private JavaScript compiler dependencies for their plugin APIs.

pnpm build:examples builds every Vite example and its workspace dependencies. To run one locally, use pnpm exec turbo dev --filter=ts-counter. pnpm test:treeshaking checks the production consumer bundles. pnpm check runs the workspace checks and builds through Turborepo.

Explore projetos relacionados

Carregando…