Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/reactjs/react.dev into sync…
Browse files Browse the repository at this point in the history
…-a472775b
  • Loading branch information
react-translations-bot committed Aug 7, 2023
2 parents 7981daf + a472775 commit 53f3804
Show file tree
Hide file tree
Showing 34 changed files with 227 additions and 102 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"plugins": ["@typescript-eslint"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "warn"
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
"react-hooks/exhaustive-deps": "error"
},
"env": {
"node": true,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/site_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Use Node.js 20.x
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1.7.10
uses: bahmutov/npm-install@v1.8.32

- name: Lint codebase
run: yarn ci-check
32 changes: 12 additions & 20 deletions src/components/Layout/HomeContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import {
useState,
useContext,
useId,
Fragment,
Suspense,
useEffect,
useRef,
useTransition,
useReducer,
} from 'react';
import cn from 'classnames';
import NextLink from 'next/link';
Expand All @@ -26,7 +24,6 @@ import {IconSearch} from 'components/Icon/IconSearch';
import {Logo} from 'components/Logo';
import Link from 'components/MDX/Link';
import CodeBlock from 'components/MDX/CodeBlock';
import {IconNavArrow} from 'components/Icon/IconNavArrow';
import {ExternalLink} from 'components/ExternalLink';
import sidebarBlog from '../../sidebarBlog.json';

Expand Down Expand Up @@ -67,14 +64,6 @@ function Para({children}) {
);
}

function Left({children}) {
return (
<div className="px-5 lg:px-0 max-w-4xl lg:text-left text-white text-opacity-80">
{children}
</div>
);
}

function Center({children}) {
return (
<div className="px-5 lg:px-0 max-w-4xl lg:text-center text-white text-opacity-80 flex flex-col items-center justify-center">
Expand All @@ -90,19 +79,23 @@ function FullBleed({children}) {
}

function CurrentTime() {
const msPerMinute = 60 * 1000;
const date = new Date();
let nextMinute = Math.floor(+date / msPerMinute + 1) * msPerMinute;

const [date, setDate] = useState(new Date());
const currentTime = date.toLocaleTimeString([], {
hour: 'numeric',
minute: 'numeric',
});
let [, forceUpdate] = useReducer((n) => n + 1, 0);
useEffect(() => {
const timeout = setTimeout(forceUpdate, nextMinute - Date.now());
const msPerMinute = 60 * 1000;
let nextMinute = Math.floor(+date / msPerMinute + 1) * msPerMinute;

const timeout = setTimeout(() => {
if (Date.now() > nextMinute) {
setDate(new Date());
}
}, nextMinute - Date.now());
return () => clearTimeout(timeout);
}, [date]);

return <span suppressHydrationWarning>{currentTime}</span>;
}

Expand Down Expand Up @@ -839,7 +832,7 @@ function ExampleLayout({
.filter((s) => s !== null);
setOverlayStyles(nextOverlayStyles);
}
}, [activeArea]);
}, [activeArea, hoverTopOffset]);
return (
<div className="lg:pl-10 lg:pr-5 w-full">
<div className="mt-12 mb-2 lg:my-16 max-w-7xl mx-auto flex flex-col w-full lg:rounded-2xl lg:bg-card lg:dark:bg-card-dark">
Expand Down Expand Up @@ -1219,7 +1212,7 @@ function useNestedScrollLock(ref) {
window.removeEventListener('scroll', handleScroll);
clearInterval(interval);
};
}, []);
}, [ref]);
}

function ExamplePanel({
Expand All @@ -1228,7 +1221,6 @@ function ExamplePanel({
noShadow,
height,
contentMarginTop,
activeArea,
}) {
return (
<div
Expand Down
1 change: 1 addition & 0 deletions src/components/Layout/Sidebar/SidebarLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function SidebarLink({
ref={ref}
title={title}
target={target}
passHref
aria-current={selected ? 'page' : undefined}
className={cn(
'p-2 pr-2 w-full rounded-none lg:rounded-r-2xl text-left hover:bg-gray-5 dark:hover:bg-gray-80 relative flex items-center justify-between',
Expand Down
1 change: 0 additions & 1 deletion src/components/Layout/SidebarNav/SidebarNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import {Suspense} from 'react';
import * as React from 'react';
import cn from 'classnames';
import {Search} from 'components/Search';
import {Feedback} from '../Feedback';
import {SidebarRouteTree} from '../Sidebar/SidebarRouteTree';
import type {RouteItem} from '../getRouteMeta';
Expand Down
3 changes: 1 addition & 2 deletions src/components/Layout/TopNav/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import {IconSearch} from 'components/Icon/IconSearch';
import {Search} from 'components/Search';
import {Logo} from '../../Logo';
import {Feedback} from '../Feedback';
import {SidebarRouteTree} from '../Sidebar/SidebarRouteTree';
import {SidebarRouteTree} from '../Sidebar';
import type {RouteItem} from '../getRouteMeta';
import {SidebarLink} from '../Sidebar';

declare global {
interface Window {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/getRouteMeta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function getRouteMeta(cleanedPath: string, routeTree: RouteItem) {
currentIndex: 0,
};
buildRouteMeta(cleanedPath, routeTree, ctx);
const {currentIndex, ...meta} = ctx;
const {currentIndex: _, ...meta} = ctx;
return {
...meta,
breadcrumbs: breadcrumbs.length > 0 ? breadcrumbs : [routeTree],
Expand Down
1 change: 1 addition & 0 deletions src/components/MDX/BlogCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function BlogCard({title, badge, date, icon, url, children}: BlogCardProps) {
return (
<Link
href={url as string}
passHref
className="block h-full w-full rounded-2xl outline-none focus:outline-none focus-visible:outline focus-visible:outline-link focus:outline-offset-2 focus-visible:dark:focus:outline-link-dark">
<div className="justify-between p-5 sm:p-5 cursor-pointer w-full h-full flex flex-col flex-1 shadow-secondary-button-stroke dark:shadow-secondary-button-stroke-dark hover:bg-gray-40/5 active:bg-gray-40/10 hover:dark:bg-gray-60/5 active:dark:bg-gray-60/10 rounded-2xl text-xl text-primary dark:text-primary-dark leading-relaxed">
<div className="flex flex-row gap-3 w-full">
Expand Down
3 changes: 2 additions & 1 deletion src/components/MDX/MDXComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ function YouTubeIframe(props: any) {
}

function Image(props: any) {
return <img className="max-w-[calc(min(700px,100%))]" {...props} />;
const {alt, ...rest} = props;
return <img alt={alt} className="max-w-[calc(min(700px,100%))]" {...rest} />;
}

export const MDXComponents = {
Expand Down
1 change: 0 additions & 1 deletion src/components/MDX/Sandpack/CustomPreset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const CustomPreset = memo(function CustomPreset({

const SandboxShell = memo(function SandboxShell({
showDevTools,
onDevToolsLoad,
devToolsLoaded,
providedFiles,
lintErrors,
Expand Down
8 changes: 5 additions & 3 deletions src/components/MDX/Sandpack/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
} else {
return;
}
}, [isMultiFile]);

// Note: in a real useEvent, onContainerResize would be omitted.
}, [isMultiFile, onContainerResize]);

const handleReset = () => {
/**
* resetAllFiles must come first, otherwise
* the previous content will appears for a second
* the previous content will appear for a second
* when the iframe loads.
*
* Plus, it should only prompts if there's any file changes
* Plus, it should only prompt if there's any file changes
*/
if (
sandpack.editorState === 'dirty' &&
Expand Down
1 change: 0 additions & 1 deletion src/components/MDX/Sandpack/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export function Preview({
errorScreenRegisteredRef,
openInCSBRegisteredRef,
loadingScreenRegisteredRef,
status,
} = sandpack;

if (
Expand Down
1 change: 0 additions & 1 deletion src/components/MDX/TeamMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Image from 'next/image';
import {IconTwitter} from '../Icon/IconTwitter';
import {IconGitHub} from '../Icon/IconGitHub';
import {ExternalLink} from '../ExternalLink';
import {IconNewPage} from 'components/Icon/IconNewPage';
import {H3} from './Heading';
import {IconLink} from 'components/Icon/IconLink';

Expand Down
3 changes: 1 addition & 2 deletions src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import Head from 'next/head';
import Link from 'next/link';
import Router from 'next/router';
import {lazy, useCallback, useEffect} from 'react';
import {lazy, useEffect} from 'react';
import * as React from 'react';
import {createPortal} from 'react-dom';
import {siteConfig} from 'siteConfig';
import cn from 'classnames';

export interface SearchProps {
appId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To set expectations, this is not a roadmap with clear timelines. Many of these p

## Server Components {/*server-components*/}

We announced an [experimental demo of React Server Components](https://reactjs.org/blog/2020/12/21/data-fetching-with-react-server-components) (RSC) in December 2020. Since then we’ve been finishing up its dependencies in React 18, and working on changes inspired by experimental feedback.
We announced an [experimental demo of React Server Components](https://legacy.reactjs.org/blog/2020/12/21/data-fetching-with-react-server-components.html) (RSC) in December 2020. Since then we’ve been finishing up its dependencies in React 18, and working on changes inspired by experimental feedback.

In particular, we’re abandoning the idea of having forked I/O libraries (eg react-fetch), and instead adopting an async/await model for better compatibility. This doesn’t technically block RSC’s release because you can also use routers for data fetching. Another change is that we’re also moving away from the file extension approach in favor of [annotating boundaries](https://github.com/reactjs/rfcs/pull/189#issuecomment-1116482278).

Expand Down
82 changes: 41 additions & 41 deletions src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,77 +10,77 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c

## Upcoming Conferences {/*upcoming-conferences*/}

### Reactathon 2023 {/*reactathon-2023*/}
May 2 - 3, 2023. San Francisco, CA, USA

[Website](https://reactathon.com) - [Twitter](https://twitter.com/reactathon) - [YouTube](https://www.youtube.com/realworldreact)
### React Rally 2023 🐙 {/*react-rally-2023*/}
August 17 & 18, 2023. Salt Lake City, UT, USA

### RemixConf 2023 {/*remixconf-2023*/}
May, 2023. Salt Lake City, UT
[Website](https://www.reactrally.com/) - [Twitter](https://twitter.com/ReactRally) - [Instagram](https://www.instagram.com/reactrally/)

[Website](https://remix.run/conf/2023) - [Twitter](https://twitter.com/remix_run)
### React India 2023 {/*react-india-2023*/}
Oct 5 - 7, 2023. In-person in Goa, India (hybrid event) + Oct 3 2023 - remote day

### App.js Conf 2023 {/*appjs-conf-2023*/}
May 10 - 12, 2023. In-person in Kraków, Poland + remote
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)

[Website](https://appjs.co) - [Twitter](https://twitter.com/appjsconf)
### React Advanced 2023 {/*react-advanced-2023*/}
October 20 & 23, 2023. In-person in London, UK + remote first interactivity (hybrid event)

### Chain React 2023 {/*chain-react-2023*/}
May 17 - 19, 2023. Portland, OR, USA
[Website](https://www.reactadvanced.com/) - [Twitter](https://twitter.com/ReactAdvanced) - [Facebook](https://www.facebook.com/ReactAdvanced) - [Videos](https://portal.gitnation.org/events/react-advanced-conference-2023)

[Website](https://chainreactconf.com/) - [Twitter](https://twitter.com/ChainReactConf) - [Facebook](https://www.facebook.com/ChainReactConf/) - [Youtube](https://www.youtube.com/channel/UCwpSzVt7QpLDbCnPXqR97-g/playlists)
### React Summit US 2023 {/*react-summit-us-2023*/}
November 13 & 15, 2023. In-person in New York, US + remote first interactivity (hybrid event)

### Render(ATL) 2023 🍑 {/*renderatl-2023-*/}
May 31 - June 2, 2023. Atlanta, GA, USA
[Website](https://reactsummit.us) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://portal.gitnation.org/events/react-summit-us-2023)

[Website](https://renderatl.com) - [Discord](https://www.renderatl.com/discord) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl) - [Podcast](https://www.renderatl.com/culture-and-code#/)
### React Day Berlin 2023 {/*react-day-berlin-2023*/}
December 8 & 12, 2023. In-person in Berlin, Germany + remote first interactivity (hybrid event)

### React Summit 2023 {/*react-summit-2023*/}
June 2 & 6, 2023. In-person in Amsterdam, Netherlands + remote first interactivity (hybrid event)
[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/) - [Videos](https://portal.gitnation.org/events/react-day-berlin-2023)

[Website](https://reactsummit.com) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://portal.gitnation.org/events/react-summit-2023)
## Past Conferences {/*past-conferences*/}

### React Norway 2023 {/*react-norway-2023*/}
June 16th, 2023. Larvik, Norway
### React Nexus 2023 {/*react-nexus-2023*/}
July 07 & 08, 2023. Bangalore, India (In-person event)

[Website](https://reactnorway.com/) - [Twitter](https://twitter.com/ReactNorway/) - [Facebook](https://www.facebook.com/reactdaynorway/)
[Website](https://reactnexus.com/) - [Twitter](https://twitter.com/ReactNexus) - [Linkedin](https://www.linkedin.com/company/react-nexus) - [YouTube](https://www.youtube.com/reactify_in)

### ReactNext 2023 {/*reactnext-2023*/}
June 27th, 2023. Tel Aviv, Israel

[Website](https://www.react-next.com/) - [Facebook](https://www.facebook.com/ReactNextConf) - [Youtube](https://www.youtube.com/@ReactNext)

### React Nexus 2023 {/*react-nexus-2023*/}
July 07 & 08, 2023. Bangalore, India (In-person event)
### React Norway 2023 {/*react-norway-2023*/}
June 16th, 2023. Larvik, Norway

[Website](https://reactnexus.com/) - [Twitter](https://twitter.com/ReactNexus) - [Linkedin](https://www.linkedin.com/company/react-nexus) - [YouTube](https://www.youtube.com/reactify_in)
[Website](https://reactnorway.com/) - [Twitter](https://twitter.com/ReactNorway/) - [Facebook](https://www.facebook.com/reactdaynorway/)

### React Rally 2023 🐙 {/*react-rally-2023*/}
August 17 & 18, 2023. Salt Lake City, UT, USA
### React Summit 2023 {/*react-summit-2023*/}
June 2 & 6, 2023. In-person in Amsterdam, Netherlands + remote first interactivity (hybrid event)

[Website](https://www.reactrally.com/) - [Twitter](https://twitter.com/ReactRally) - [Instagram](https://www.instagram.com/reactrally/)
[Website](https://reactsummit.com) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://portal.gitnation.org/events/react-summit-2023)

### React India 2023 {/*react-india-2023*/}
Oct 5 - 7, 2023. In-person in Goa, India (hybrid event) + Oct 3 2023 - remote day
### Render(ATL) 2023 🍑 {/*renderatl-2023-*/}
May 31 - June 2, 2023. Atlanta, GA, USA

[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)
[Website](https://renderatl.com) - [Discord](https://www.renderatl.com/discord) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl) - [Podcast](https://www.renderatl.com/culture-and-code#/)

### React Advanced 2023 {/*react-advanced-2023*/}
October 20 & 23, 2023. In-person in London, UK + remote first interactivity (hybrid event)
### Chain React 2023 {/*chain-react-2023*/}
May 17 - 19, 2023. Portland, OR, USA

[Website](https://www.reactadvanced.com/) - [Twitter](https://twitter.com/ReactAdvanced) - [Facebook](https://www.facebook.com/ReactAdvanced) - [Videos](https://portal.gitnation.org/events/react-advanced-conference-2023)
[Website](https://chainreactconf.com/) - [Twitter](https://twitter.com/ChainReactConf) - [Facebook](https://www.facebook.com/ChainReactConf/) - [Youtube](https://www.youtube.com/channel/UCwpSzVt7QpLDbCnPXqR97-g/playlists)

### React Summit US 2023 {/*react-summit-us-2023*/}
November 13 & 15, 2023. In-person in New York, US + remote first interactivity (hybrid event)
### App.js Conf 2023 {/*appjs-conf-2023*/}
May 10 - 12, 2023. In-person in Kraków, Poland + remote

[Website](https://reactsummit.us) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://portal.gitnation.org/events/react-summit-us-2023)
[Website](https://appjs.co) - [Twitter](https://twitter.com/appjsconf)

### React Day Berlin 2023 {/*react-day-berlin-2023*/}
December 8 & 12, 2023. In-person in Berlin, Germany + remote first interactivity (hybrid event)
### RemixConf 2023 {/*remixconf-2023*/}
May, 2023. Salt Lake City, UT

[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/) - [Videos](https://portal.gitnation.org/events/react-day-berlin-2023)
[Website](https://remix.run/conf/2023) - [Twitter](https://twitter.com/remix_run)

## Past Conferences {/*past-conferences*/}
### Reactathon 2023 {/*reactathon-2023*/}
May 2 - 3, 2023. San Francisco, CA, USA

[Website](https://reactathon.com) - [Twitter](https://twitter.com/reactathon) - [YouTube](https://www.youtube.com/realworldreact)

### React Miami 2023 {/*react-miami-2023*/}
April 20 - 21, 2023. Miami, FL, USA
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/you-might-not-need-an-effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ It would be nice if there was a way to tell React that when `savedContact.id` is
<Solution>
Split the `EditContact` component in two. Move all the form state into the inner `EditForm` component. Export the outer `EditContact` component, and make it pass `savedContact.id` as the `key` to the inner `EditContact` component. As a result, the inner `EditForm` component resets all of the form state and recreates the DOM whenever you select a different contact.
Split the `EditContact` component in two. Move all the form state into the inner `EditForm` component. Export the outer `EditContact` component, and make it pass `savedContact.id` as the `key` to the inner `EditForm` component. As a result, the inner `EditForm` component resets all of the form state and recreates the DOM whenever you select a different contact.
<Sandpack>
Expand Down
2 changes: 1 addition & 1 deletion src/content/reference/react-dom/client/hydrateRoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Calling `root.unmount` will unmount all the components in the root and "detach"
#### Returns {/*root-unmount-returns*/}
`render` returns `null`.
`root.unmount` returns `undefined`.
#### Caveats {/*root-unmount-caveats*/}
Expand Down
Loading

0 comments on commit 53f3804

Please sign in to comment.