站内导读
定位:React 是用于构建用户界面的 JavaScript 库,由 Meta 与开源社区维护,适合需要随数据变化更新交互界面的前端项目。
核心能力
- 声明式渲染:你为每个状态描述视图,数据变化时 React 只更新并渲染对应的组件。
- 组件化:组件自行管理 state 并组合成复杂界面,逻辑写在 JavaScript 里而不是模板中。
- state 保留在组件层而非 DOM,可在应用中传递复杂数据,不必重写现有技术栈。
- 借助 Node 做服务端渲染,通过 React Native 构建移动应用,支持按需渐进引入。
适用人群:具备 JavaScript 基础的前端开发者,用于把 React 加入现有项目或新建应用;服务端渲染需 Node 环境。
注意:README 仅涉及安装、文档与贡献,未列出性能或版本限制。
位置づけ:React はユーザーインターフェースを構築するための JavaScript ライブラリで、Meta とオープンソースコミュニティが維持しています。データの変化に応じて画面を更新するインタラクティブなフロントエンドプロジェクトに向いています。
主な機能
- 宣言的レンダリング:状態ごとにビューを記述すると、データが変化したときに React が該当するコンポーネントだけを効率よく更新・再描画します。
- コンポーネントベース:コンポーネントが自前の state を持ち、それらを組み合わせて複雑な画面を構築します。ロジックはテンプレートではなく JavaScript で記述します。
- state は DOM ではなくコンポーネント層に保持されるため、既存の技術スタックを書き直さずにアプリ全体へ豊富なデータを渡せます。
- Node によるサーバーサイドレンダリングや React Native によるモバイルアプリ開発にも対応し、必要な分だけ段階的に導入できます。
対象ユーザー:JavaScript の基礎があるフロントエンド開発者。既存プロジェクトへの追加導入にも新規アプリの開発にも使えます。サーバーサイドレンダリングには Node 環境が必要です。
注意:README はインストール、ドキュメント、コントリビューションに関する内容が中心で、パフォーマンスやバージョンの制限については触れられていません。
정의: React는 사용자 인터페이스를 구축하기 위한 JavaScript 라이브러리로, Meta와 오픈소스 커뮤니티가 유지보수합니다. 데이터 변화에 따라 화면이 갱신되는 인터랙티브한 프론트엔드 프로젝트에 적합합니다.
핵심 기능
- 선언적 렌더링: 상태마다 뷰를 기술하면 데이터가 바뀔 때 React가 해당 컴포넌트만 효율적으로 업데이트하고 다시 렌더링합니다.
- 컴포넌트 기반: 컴포넌트가 자체 state를 관리하며 이를 조합해 복잡한 화면을 구성합니다. 로직은 템플릿이 아닌 JavaScript로 작성합니다.
- state를 DOM이 아닌 컴포넌트 계층에 보관하므로 기존 기술 스택을 다시 쓰지 않고도 앱 전체에 풍부한 데이터를 전달할 수 있습니다.
- Node를 통한 서버 사이드 렌더링과 React Native를 통한 모바일 앱 개발을 지원하며, 필요한 만큼만 점진적으로 도입할 수 있습니다.
대상 사용자: JavaScript 기초가 있는 프론트엔드 개발자로, 기존 프로젝트에 React를 추가하거나 새 앱을 만들 때 사용합니다. 서버 사이드 렌더링에는 Node 환경이 필요합니다.
참고: README는 설치, 문서, 기여에 관한 내용이 중심이며 성능이나 버전 제한은 다루지 않습니다.
What it is: React is a JavaScript library for building user interfaces, maintained by Meta and the open-source community. It fits projects that need interactive UI with state that changes over time.
Key capabilities
- Declarative rendering: you describe the UI for each state, and React updates and re-renders only the components affected when data changes.
- Component-based model: components encapsulate their own state and are composed into complex UIs, with logic in JavaScript rather than templates.
- State kept out of the DOM, so rich data can be passed through the app without rewriting an existing stack.
- Server rendering via Node and mobile apps via React Native, with gradual adoption: use as little or as much as needed.
README · 详细文档
来源 · 查看原文
React · 0 1 2 3 4
React is a JavaScript library for building user interfaces.
- Declarative: React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable, simpler to understand, and easier to debug.
- Component-Based: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep the state out of the DOM.
- Learn Once, Write Anywhere: We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using React Native.
Learn how to use React in your project.
Installation
React has been designed for gradual adoption from the start, and you can use as little or as much React as you need:
- Use Quick Start to get a taste of React.
- Add React to an Existing Project to use as little or as much React as you need.
- Create a New React App if you're looking for a powerful JavaScript toolchain.
Documentation
You can find the React documentation on the website.
Check out the Getting Started page for a quick overview.
The documentation is divided into several sections:
- Quick Start
- Tutorial
- Thinking in React
- Installation
- Describing the UI
- Adding Interactivity
- Managing State
- Advanced Guides
- API Reference
- Where to Get Support
- Contributing Guide
You can improve it by sending pull requests to this repository.
Examples
We have several examples on the website. Here is the first one to get you started:
import { createRoot } from 'react-dom/client';
function HelloMessage({ name }) {
return <div>Hello {name}</div>;
}
const root = createRoot(document.getElementById('container'));
root.render(<HelloMessage name="Taylor" />);
This example will render "Hello Taylor" into a container on the page.
You'll notice that we used an HTML-like syntax; we call it JSX. JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML.
Contributing
The main purpose of this repository is to continue evolving React core, making it faster and easier to use. Development of React happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving React.
Code of Conduct
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
Contributing Guide
Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React.
Good First Issues
To help you get your feet wet and get you familiar with our contribution process, we have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place to get started.
License
React is MIT licensed.