React1-使用方法(Installation)

React is flexible and can be used in a variety of projects. You can creat new apps with it, but you can also gradually introduce it into an existing codebase without doing a rewrite.

React 是一个弹性化的技术方案,便于应用不同类型的项目中。你可以从零开始创建一个新的项目,也可以将React循序渐进集成到一个已经上线的项目中。

Try React(尝试React)

React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started.

React从一开始就被设计用于逐步采用,您可以根据需要使用尽可能少的React。不管你是想体验下React,为一个简单的HTML页面添加一些交互,还是开始启动一个复杂的React驱动的应用程序,本节的链接都可以帮助到你。

Online Playgrounds(在线工具)

If you’re interested in playing around with React, you can use an online code playground. Try a Hello World template on CodePen or CodeSandbox.

If you prefer to use your own text editor, you can also download this HTML file, edit it, and open it from the local filesystem in your browser. It does a slow runtime code transformation, so we’d only recommend using this for simple demos.

如果你对React感兴趣,你可以使用在线的代码工具。在CodePenCodeSandbox上尝试Hello World模板。

如果你更喜欢自己的文本编辑器,你也可以下载此HTML文件,进行编辑,在浏览器中打开你本地下载好的文件。注意:这个文件中包含一个运行时的代码编译,会影响代码的运行效率,所以我们只建议用于简单的演示。

Add React to a Website(将React添加到网站)

You can add React to an HTML page in one minute. You can then either gradually expand its presence, or keep it contained to a few dynamic widgets.

你可以在一分钟内将React添加到HTML页面。然后,您可以逐步扩展它的存在,或者将其保持在一些动态小部件中。

Create a New React App(创建一个新的React应用程序)

When starting a React project, a simple HTML page with script tags might still be the best option. It only takes a minute to set up!

As your application grows, you might want to consider a more integrated setup. There are several JavaScript toolchains we recommend for larger applications. Each of them can work with little to no configuration and lets you take full advantage of the rich React ecosystem.

启动一个React项目,带有脚本标记的简单HTML页面可能仍是一个最佳选择。设置好这样的,只需要一分钟就能完成。

随着应用程序的增长,你可能需要考虑更集成的设置。有几个JavaScript的工具链,我们建议对于较大的应用程序。它们中的每一个都可以使用很少甚至没有配置,让您充分利用丰富的React生态系统。

Learn React(学习React)

People come to React from different backgrounds and with different learning styles. Whether you prefer a more theoretical or a practical approach, we hope you’ll find this section helpful.

Like any unfamiliar technology, React does have a learning curve. With practice and some patience, you will get the hang of it.

人们来自不同背景和不同的方式学习React。无论您是更喜欢理论还是实用的方法,我们您会发现本书有很大的帮助。

像任何不熟悉的技术一样,React确实有学习曲线。通过练习和一些耐心,你掌握它。

First Examples

The React homepage contains a few small React examples with a live editor. Even if you don’t know anything about React yet, try changing their code and see how it affects the result.

JavaScript Resources

The React documentation assumes some familiarity with programming in the JavaScript language. You don’t have to be an expert, but it’s harder to learn both React and JavaScript at the same time.

We recommend going through this JavaScript overview to check your knowledge level. It will take you between 30 minutes and an hour but you will feel more confident learning React.

Tip

Whenever you get confused by something in JavaScript, MDN and javascript.info are great websites to check. There are also community support forums where you can ask for help.

Practical Tutorial

If you prefer to learn by doing, check out our practical tutorial. In this tutorial, we build a tic-tac-toe game in React. You might be tempted to skip it because you’re not building games — but give it a chance. The techniques you’ll learn in the tutorial are fundamental to building any React apps, and mastering it will give you a much deeper understanding.

Step-by-Step Guide

If you prefer to learn concepts step by step, our guide to main concepts is the best place to start. Every next chapter in it builds on the knowledge introduced in the previous chapters so you won’t miss anything as you go along.

Thinking in React

Many React users credit reading Thinking in React as the moment React finally “clicked” for them. It’s probably the oldest React walkthrough but it’s still just as relevant.

Sometimes people find third-party books and video courses more helpful than the official documentation. We maintain a list of commonly recommended resources, some of which are free.

Advanced Concepts

Once you’re comfortable with the main concepts and played with React a little bit, you might be interested in more advanced topics. This section will introduce you to the powerful, but less commonly used React features like context and refs.

API Reference

This documentation section is useful when you want to learn more details about a particular React API. For example, React.Component API reference can provide you with details on how setState() works, and what different lifecycle hooks are useful for.

Glossary and FAQ

The glossary contains an overview of the most common terms you’ll see in the React documentation. There is also a FAQ section dedicated to short questions and answers about common topics, including making AJAX requestscomponent state, and file structure.

Staying Informed

The React blog is the official source for the updates from the React team. Anything important, including release notes or deprecation notices, will be posted there first.

You can also follow the @reactjs account on Twitter, but you won’t miss anything essential if you only read the blog.

Not every React release deserves its own blog post, but you can find a detailed changelog for every release in the CHANGELOG.md file in the React repository, as well as on the Releasespage.

Versioned Documentation

This documentation always reflects the latest stable version of React. Since React 16, you can find older versions of the documentation on a separate page. Note that documentation for past versions is snapshotted at the time of the release, and isn’t being continuously updated.

Something Missing?

If something is missing in the documentation or if you found some part confusing, please file an issue for the documentation repository with your suggestions for improvement, or tweet at the @reactjs account. We love hearing from you!

猜你喜欢

转载自blog.csdn.net/weixin_39466493/article/details/81218487