Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions content/authors.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Map of short name to more information. `name` will be used but if you don't
# want to use your real name, just use whatever. If url is included, your name
# will be a link to the provided url.
abernathyca:
name: Christine Abernathy
url: https://twitter.com/abernathyca
acdlite:
name: Andrew Clark
url: https://twitter.com/acdlite
Expand Down Expand Up @@ -70,12 +73,18 @@ petehunt:
rachelnabors:
name: Rachel Nabors
url: https://twitter.com/rachelnabors
rickhanlonii:
name: Rick Hanlon
url: https://twitter.com/rickhanlonii
schrockn:
name: Nick Schrock
url: https://twitter.com/schrockn
sebmarkbage:
name: Sebastian Markbåge
url: https://twitter.com/sebmarkbage
sethwebster:
name: Seth Webster
url: https://twitter.com/sethwebster
sophiebits:
name: Sophie Alpert
url: https://sophiebits.com/
Expand Down
59 changes: 59 additions & 0 deletions content/blog/2021-06-08-the-plan-for-react-18.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: "The Plan for React 18"
author: [acdlite, bvaughn, abernathyca, gaearon, rachelnabors, rickhanlonii, sebmarkbage, sethwebster]
---

The React team is excited to share a few updates:

1. We’ve started work on the React 18 release, which will be our next major version.
2. We’ve created a Working Group to prepare the community for gradual adoption of new features in React 18.
3. We’ve published a React 18 Alpha so that library authors can try it and provide feedback.

These updates are primarily aimed at maintainers of third-party libraries. If you’re learning, teaching, or using React to build user-facing applications, you can safely ignore this post. But you are welcome to follow the discussions in the React 18 Working Group if you're curious!

## What’s coming in React 18

When it’s released, React 18 will include out-of-the-box improvements (like [automatic batching](https://github.com/reactwg/react-18/discussions/21)), new APIs (like [`startTransition`](https://github.com/reactwg/react-18/discussions/41)), and a [new streaming server renderer](https://github.com/reactwg/react-18/discussions/37) with built-in support for `React.lazy`.

These features are possible thanks to a new opt-in mechanism we’re adding in React 18. It’s called “concurrent rendering” and it lets React prepare multiple versions of the UI at the same time. This change is mostly behind-the-scenes, but it unlocks new possibilities to improve both real and perceived performance of your app.

If you've been following our research into the future of React (we don't expect you to!), you might have heard of something called “concurrent mode” or that it might break your app. In response to this feedback from the community, we’ve redesigned the upgrade strategy for gradual adoption. Instead of an all-or-nothing “mode”, concurrent rendering will only be enabled for updates triggered by one of the new features. In practice, this means **you will be able to adopt React 18 without rewrites and try the new features at your own pace.**

## A gradual adoption strategy

Since concurrency in React 18 is opt-in, there are no significant out-of-the-box breaking changes to component behavior. **You can upgrade to React 18 with minimal or no changes to your application code, with a level of effort comparable to a typical major React release**. Based on our experience converting several apps to React 18, we expect that many users will be able to upgrade within a single afternoon.

We successfully shipped concurrent features to tens of thousands of components at Facebook, and in our experience, we've found that most React components “just work” without additional changes. We're committed to making sure this is a smooth upgrade for the entire community, so today we're announcing the React 18 Working Group.

## Working with the community

We’re trying something new for this release: We've invited a panel of experts, developers, library authors, and educators from across the React community to participate in our [React 18 Working Group](https://github.com/reactwg/react-18) to provide feedback, ask questions, and collaborate on the release. We couldn't invite everyone we wanted to this initial, small group, but if this experiment works out, we hope there will be more in the future!

**The goal of the React 18 Working Group is to prepare the ecosystem for a smooth, gradual adoption of React 18 by existing applications and libraries.** The Working Group is hosted on [GitHub Discussions](https://github.com/reactwg/react-18/discussions) and is available for the public to read. Members of the working group can leave feedback, ask questions, and share ideas. The core team will also use the discussions repo to share our research findings. As the stable release gets closer, any important information will also be posted on this blog.

For more information on upgrading to React 18, or additional resources about the release, see the [React 18 announcement post](https://github.com/reactwg/react-18/discussions/4).

## Accessing the React 18 Working Group

Everyone can read the discussions in the [React 18 Working Group repo](https://github.com/reactwg/react-18).

Because we expect an initial surge of interest in the Working Group, only invited members will be allowed to create or comment on threads. However, the threads are fully visible to the public, so everyone has access to the same information. We believe this is a good compromise between creating a productive environment for working group members, while maintaining transparency with the wider community.

As always, you can submit bug reports, questions, and general feedback to our [issue tracker](https://github.com/facebook/react/issues).

## How to try React 18 Alpha today

New alphas are [regularly published to npm using the `@alpha` tag](https://github.com/reactwg/react-18/discussions/9). These releases are built using the most recent commit to our main repo. When a feature or bugfix is merged, it will appear in an alpha the following weekday.

There may be significant behavioral or API changes between alpha releases. Please remember that **alpha releases are not recommended for user-facing, production applications**.

## Projected React 18 release timeline

We don't have a specific release date scheduled, but we expect it will take several months of feedback and iteration before React 18 is ready for most production applications.

* Library Alpha: Available today
* Public Beta: At least several months
* Release Candidate (RC): At least several weeks after Beta
* General Availability: At least several weeks after RC

More details about our projected release timeline are [available in the Working Group](https://github.com/reactwg/react-18/discussions/9). We'll post updates on this blog when we're closer to a public release.
7 changes: 6 additions & 1 deletion content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ September 13-15, 2021. Atlanta, GA, USA

[Website](https://renderatl.com) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl)

### React Conference Live 2021 {#react-conference-live-2021}
October 7-8, 2021. In-person in Amsterdam, Netherlands + remote (hybrid event)

[Website](https://www.reactlive.nl/) - [Twitter](https://twitter.com/reactlivenl) - [LinkedIn](https://www.linkedin.com/company/frontendlove/)

### React Advanced 2021 {#react-advanced-2021}
October 22-23, 2021. In-person in London, UK + remote (hybrid event)

[Website](https://reactadvanced.com) - [Twitter](http://twitter.com/reactadvanced) - [Facebook](https://www.facebook.com/ReactAdvanced) - [Videos](https://youtube.com/c/ReactConferences)
[Website](https://reactadvanced.com) - [Twitter](https://twitter.com/reactadvanced) - [Facebook](https://www.facebook.com/ReactAdvanced) - [Videos](https://youtube.com/c/ReactConferences)

### React India 2021 {#react-india-2021}
November 12-13, 2021 in Mumbai, India
Expand Down
9 changes: 4 additions & 5 deletions content/docs/concurrent-mode-adoption.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ next: concurrent-mode-reference.html

>Caution:
>
>This page describes **experimental features that are not yet available in a stable release**. Don't rely on experimental builds of React in production apps. These features may change significantly and without a warning before they become a part of React.
>This page was about experimental features that aren't yet available in a stable release. It was aimed at early adopters and people who are curious.
>
>This documentation is aimed at early adopters and people who are curious. **If you're new to React, don't worry about these features** -- you don't need to learn them right now.

>Caution:
>Much of the information on this page is now outdated and exists only for archival purposes. **Please refer to the [React 18 Alpha announcement post](/blog/2021/06/08/the-plan-for-react-18.html
) for the up-to-date information.**
>
>All references below to "blocking mode" and `createBlockingRoot` are outdated and should be ignored.
>Before React 18 is released, we will replace this page with stable documentation.

</div>

Expand Down
7 changes: 5 additions & 2 deletions content/docs/concurrent-mode-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ next: concurrent-mode-suspense.html

>Caution:
>
>This page describes **experimental features that are [not yet available](/docs/concurrent-mode-adoption.html) in a stable release**. Don't rely on experimental builds of React in production apps. These features may change significantly and without a warning before they become a part of React.
>This page was about experimental features that aren't yet available in a stable release. It was aimed at early adopters and people who are curious.
>
>This documentation is aimed at early adopters and people who are curious. **If you're new to React, don't worry about these features** -- you don't need to learn them right now.
>Much of the information on this page is now outdated and exists only for archival purposes. **Please refer to the [React 18 Alpha announcement post](/blog/2021/06/08/the-plan-for-react-18.html
) for the up-to-date information.**
>
>Before React 18 is released, we will replace this page with stable documentation.

</div>

Expand Down
7 changes: 5 additions & 2 deletions content/docs/concurrent-mode-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ next: concurrent-mode-adoption.html

>Caution:
>
>This page describes **experimental features that are [not yet available](/docs/concurrent-mode-adoption.html) in a stable release**. Don't rely on experimental builds of React in production apps. These features may change significantly and without a warning before they become a part of React.
>This page was about experimental features that aren't yet available in a stable release. It was aimed at early adopters and people who are curious.
>
>This documentation is aimed at early adopters and people who are curious. **If you're new to React, don't worry about these features** -- you don't need to learn them right now. For example, if you're looking for a data fetching tutorial that works today, read [this article](https://www.robinwieruch.de/react-hooks-fetch-data/) instead.
>Much of the information on this page is now outdated and exists only for archival purposes. **Please refer to the [React 18 Alpha announcement post](/blog/2021/06/08/the-plan-for-react-18.html
) for the up-to-date information.**
>
>Before React 18 is released, we will replace this page with stable documentation.

</div>

Expand Down
9 changes: 6 additions & 3 deletions content/docs/concurrent-mode-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ prev: concurrent-mode-adoption.html

>Caution:
>
>This page describes **experimental features that are [not yet available](/docs/concurrent-mode-adoption.html) in a stable release**. Don't rely on experimental builds of React in production apps. These features may change significantly and without a warning before they become a part of React.
>This page was about experimental features that aren't yet available in a stable release. It was aimed at early adopters and people who are curious.
>
>This documentation is aimed at early adopters and people who are curious. **If you're new to React, don't worry about these features** -- you don't need to learn them right now.
>Much of the information on this page is now outdated and exists only for archival purposes. **Please refer to the [React 18 Alpha announcement post](/blog/2021/06/08/the-plan-for-react-18.html
) for the up-to-date information.**
>
>Before React 18 is released, we will replace this page with stable documentation.

</div>

Expand Down Expand Up @@ -59,7 +62,7 @@ For more information on Concurrent Mode, check out the [Concurrent Mode document

`Suspense` lets your components "wait" for something before they can render, showing a fallback while waiting.

In this example, `ProfileDetails` is waiting for an asynchronous API call to fetch some data. While we wait for `ProfileDetails` and `ProfilePhoto`, we will show the `Loading...` fallback instead. It is important to note that until all children inside `<Suspense>` has loaded, we will continue to show the fallback.
In this example, `ProfileDetails` is waiting for an asynchronous API call to fetch some data. While we wait for `ProfileDetails` and `ProfilePhoto`, we will show the `Loading...` fallback instead. It is important to note that until all children inside `<Suspense>` have loaded, we will continue to show the fallback.

`Suspense` takes two props:
* **fallback** takes a loading indicator. The fallback is shown until all of the children of the `Suspense` component have finished rendering.
Expand Down
7 changes: 5 additions & 2 deletions content/docs/concurrent-mode-suspense.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ next: concurrent-mode-patterns.html

>Caution:
>
>This page describes **experimental features that are [not yet available](/docs/concurrent-mode-adoption.html) in a stable release**. Don't rely on experimental builds of React in production apps. These features may change significantly and without a warning before they become a part of React.
>This page was about experimental features that aren't yet available in a stable release. It was aimed at early adopters and people who are curious.
>
>This documentation is aimed at early adopters and people who are curious. **If you're new to React, don't worry about these features** -- you don't need to learn them right now. For example, if you're looking for a data fetching tutorial that works today, read [this article](https://www.robinwieruch.de/react-hooks-fetch-data/) instead.
>Much of the information on this page is now outdated and exists only for archival purposes. **Please refer to the [React 18 Alpha announcement post](/blog/2021/06/08/the-plan-for-react-18.html
) for the up-to-date information.**
>
>Before React 18 is released, we will replace this page with stable documentation.

</div>

Expand Down
24 changes: 12 additions & 12 deletions content/docs/handling-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ sẽ có đôi chút khác biệt trong React:
Một điểm khác biệt nữa trong React là bạn không thể trả về `false` để chặn những hành vi mặc định mà phải gọi `preventDefault` trực tiếp. Lấy ví dụ với đoạn HTML sau, để chặn hành vi mặc định của đường dẫn là mở trang mới, bạn có thể viết:

```html
<a href="#" onclick="console.log('The link was clicked.'); return false">
Click me
</a>
<form onsubmit="console.log('You clicked submit.'); return false">
<button type="submit">Submit</button>
</form>
```

Còn trong React, bạn có thể làm như thế này:

```js{2-5,8}
function ActionLink() {
function handleClick(e) {
```js{3}
function Form() {
function handleSubmit(e) {
e.preventDefault();
console.log('The link was clicked.');
console.log('You clicked submit.');
}

return (
<a href="#" onClick={handleClick}>
Click me
</a>
<form onSubmit={handleSubmit}>
<button type="submit">Submit</button>
</form>
);
}
```
Expand All @@ -71,8 +71,8 @@ class Toggle extends React.Component {
}

handleClick() {
this.setState(state => ({
isToggleOn: !state.isToggleOn
this.setState(prevState => ({
isToggleOn: !prevState.isToggleOn
}));
}

Expand Down
2 changes: 1 addition & 1 deletion content/docs/higher-order-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ The `compose` utility function is provided by many third-party libraries includi

## Convention: Wrap the Display Name for Easy Debugging {#convention-wrap-the-display-name-for-easy-debugging}

The container components created by HOCs show up in the [React Developer Tools](https://github.com/facebook/react-devtools) like any other component. To ease debugging, choose a display name that communicates that it's the result of a HOC.
The container components created by HOCs show up in the [React Developer Tools](https://github.com/facebook/react/tree/master/packages/react-devtools) like any other component. To ease debugging, choose a display name that communicates that it's the result of a HOC.

The most common technique is to wrap the display name of the wrapped component. So if your higher-order component is named `withSubscription`, and the wrapped component's display name is `CommentList`, use the display name `WithSubscription(CommentList)`:

Expand Down
13 changes: 0 additions & 13 deletions content/docs/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,6 @@
title: Testing Recipes
- id: testing-environments
title: Testing Environments
- title: Concurrent Mode (Experimental)
isOrdered: true
items:
- id: concurrent-mode-intro
title: Introducing Concurrent Mode
- id: concurrent-mode-suspense
title: Suspense for Data Fetching
- id: concurrent-mode-patterns
title: Concurrent UI Patterns
- id: concurrent-mode-adoption
title: Adopting Concurrent Mode
- id: concurrent-mode-reference
title: Concurrent Mode API Reference
- title: Contributing
items:
- id: how-to-contribute
Expand Down
2 changes: 1 addition & 1 deletion src/components/MarkdownPage/MarkdownPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const MarkdownPage = ({
<div css={{marginTop: 15}}>
{date}{' '}
{hasAuthors && (
<span>
<span css={{lineHeight: 1.75}}>
by{' '}
{toCommaSeparatedList(authors, author => (
<a
Expand Down
1 change: 1 addition & 0 deletions static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ https://en.reactjs.org/* https://reactjs.org/:splat 301!
/link/uselayouteffect-ssr https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85 301
/link/react-devtools-faq https://github.com/facebook/react/tree/master/packages/react-devtools#faq 301
/link/setstate-in-render https://github.com/facebook/react/issues/18178#issuecomment-595846312 301
/link/switch-to-createroot https://github.com/reactwg/react-18/discussions/5
Loading