Commit Graph

6860 Commits

Author SHA1 Message Date
Karl Horky
c60922ff73 Fix incorrect negative in use-memo intro (#8027) 2025-09-30 21:01:55 -04:00
Jack Pope
49c2d26722 Update useEffectEvent docs for canary (#8025)
* Update useEffectEvent docs for canary

* Clean up prefixed imports

* Fix import

* Update blog post link
2025-09-28 11:36:27 -04:00
Radoš Milićev
1b20061b10 Fix value wrongly formatted as code in useDeferredValue.md (#8024) 2025-09-26 18:15:37 +02:00
Eugene Choi
790625fd22 Fix ViewTransition examples (#7999)
* Fix view transition example

* Empty commit

* Fix fullscreen example
2025-09-23 17:25:52 -04:00
Radoš Milićev
170e5b904a Remove unnecessary spaces from useCallback.md (#8006) 2025-09-23 09:58:55 +02:00
Ricky
c8211fc21e Add RC badge to RC-only lint rules (#8005) 2025-09-22 10:18:10 -04:00
lauren
366b5fbdad Add new eslint rule reference docs (#7986)
Adds new docs for our new eslint rules.
2025-09-19 16:19:48 -04:00
lauren
c15e20f811 Install eslint-local-rules as postinstall (#7993)
For local dev and CI we want to have the eslint-local-rules running, so let's make sure both have their dependencies installed. We don't use a monorepo setup here, which is why they're currently setup as a two completely independent yarn workspaces.
2025-09-19 11:19:36 -04:00
lauren
730d045c71 Restore lint corrections from #7989 (#7997)
* Ignore braces when building Sandpack file map

Previously, `createFileMap` split the MDX meta string on spaces and assumed the first token was the filename. Once we prefixed code fences with `{expectedErrors: ...}`, it would incorrectly parse the meta and crash.

This PR updates createFileMap to skip tokens in the meta containing a start and end brace pair (using a stack to ensure we close on the correct brace) while tokenizing the meta string as expected.

Test plan: pages reported in #7994 no longer crash on the next PR

Closes #7994

* Restore lint corrections from #7989

Reverts the revert now that we've fixed the bug. These pages should no longer crash:

https://react-dev-git-pr7997-fbopensource.vercel.app/learn/referencing-values-with-refs
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/synchronizing-with-effects
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/separating-events-from-effects
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/removing-effect-dependencies
https://react-dev-git-pr7997-fbopensource.vercel.app/learn/you-might-not-need-an-effect
2025-09-18 19:18:19 -04:00
lauren
f369f3efdf Ignore braces when building Sandpack file map (#7996)
Previously, `createFileMap` split the MDX meta string on spaces and assumed the first token was the filename. Once we prefixed code fences with `{expectedErrors: ...}`, it would incorrectly parse the meta and crash.

This PR updates createFileMap to skip tokens in the meta containing a start and end brace pair (using a stack to ensure we close on the correct brace) while tokenizing the meta string as expected.

Test plan: pages reported in #7994 no longer crash on the next PR

Closes #7994
2025-09-18 19:18:09 -04:00
lauren
2a9ef2d173 Revert "fix compiler errors (#7989)" (#7995)
This reverts commit 5cc9b7ba31.
2025-09-18 18:06:43 -04:00
lauren
5cc9b7ba31 fix compiler errors (#7989)
* Add local eslint rule to validate markdown codeblocks with React Compiler

In https://github.com/facebook/react/pull/34462 for example, we found an issue where the compiler was incorrectly validating an example straight from the docs.

In order to find more issues like this + also provide more feedback to doc authors on valid/invalid patterns, this PR adds a new local eslint rule which validates all markdown codeblocks containing components/hooks with React Compiler. An autofixer is also provided.

To express that a codeblock has an expected error, we can use the following metadata:

```ts
// pseudo type def
type MarkdownCodeBlockMetadata = {
    expectedErrors?: {
      'react-compiler'?: number[];
    };
  };
```

and can be used like so:

````
```js {expectedErrors: {'react-compiler': [4]}}
//  setState directly in render
function Component({value}) {
  const [count, setCount] = useState(0);
  setCount(value); // error on L4
  return <div>{count}</div>;
}
```
````

Because this is defined as a local rule, we don't have the same granular reporting that `eslint-plugin-react-hooks` yet. I can look into that later but for now this first PR just sets us up with something basic.

* fix compiler errors

I went through the list of existing errors and tried to separate the expected errors from those that seem to be flagging unexpected issues.  In particular, our effects validations are flagging patterns that our own docs examples use. I added todos for these and will follow up later.
2025-09-18 15:32:27 -04:00
lauren
b6a32d1e0e Add local eslint rule to validate markdown codeblocks with React Compiler (#7988)
In https://github.com/facebook/react/pull/34462 for example, we found an issue where the compiler was incorrectly validating an example straight from the docs.

In order to find more issues like this + also provide more feedback to doc authors on valid/invalid patterns, this PR adds a new local eslint rule which validates all markdown codeblocks containing components/hooks with React Compiler. An autofixer is also provided.

To express that a codeblock has an expected error, we can use the following metadata:

```ts
// pseudo type def
type MarkdownCodeBlockMetadata = {
    expectedErrors?: {
      'react-compiler'?: number[];
    };
  };
```

and can be used like so:

````
```js {expectedErrors: {'react-compiler': [4]}}
//  setState directly in render
function Component({value}) {
  const [count, setCount] = useState(0);
  setCount(value); // error on L4
  return <div>{count}</div>;
}
```
````

Because this is defined as a local rule, we don't have the same granular reporting that `eslint-plugin-react-hooks` yet. I can look into that later but for now this first PR just sets us up with something basic.
2025-09-18 15:32:18 -04:00
lauren
bd03b86c02 Update copyright on all files (#7992)
* Add copyright script

Copied over our copyright script from the react repo. I made a small fix to handle shebangs.

* Update copyright on all files

Run the script.
2025-09-18 14:42:36 -04:00
lauren
a566d87b2b Add copyright script (#7991)
Copied over our copyright script from the react repo. I made a small fix to handle shebangs.
2025-09-18 14:42:27 -04:00
lauren
5b9a2ce649 Upgrade babel-plugin-react-compiler (#7985)
Happened to notice we were still on an old version of the compiler. This PR upgrades us to use the latest RC.
2025-09-16 11:05:33 -04:00
Ricky
a5181c291f Bump Activity docs to canary (#7974)
* correct IconExperimental naming and usage (from #7972)

Co-authored-by: Tuna <198469603+TunaDev0@users.noreply.github.com>

* Bump Activity to Canary in docs

---------

Co-authored-by: Tuna <198469603+TunaDev0@users.noreply.github.com>
2025-09-12 12:47:11 -04:00
Akshay Ashok
0bfd418252 docs: add flushSync Troubleshooting section (#7978)
* docs: add flushSync Troubleshooting section

* Update src/content/reference/react-dom/flushSync.md

* oops

* Apply suggestions from code review

* formatting and pitfall

---------

Co-authored-by: Ricky <rickhanlonii@gmail.com>
Co-authored-by: Rick Hanlon <rickhanlonii@meta.com>
2025-09-11 12:27:28 -04:00
Ricky
4d3d495919 Add React Conf 2024 to /videos (#7977) 2025-09-09 11:57:29 -04:00
Muhammad Tayyab
d34c6a2c6f Fix/tictactoe docs invalid file names (#7969)
* fix: changed source file names in docs from App.js, index.js and styles.css to src/ dir

* fix: updated wrong image with the correct one with current sandbox file structure

* refactor: reverted all formatting and just just mention src folder in introductory section

* Reverted changes tutorial-tic-tac-toe.md

* added enhanced image of sandbox
2025-09-04 15:06:14 -04:00
Ricky
b8e9faf702 Fix handleClick compiler intro example (#7967)
* Fix handleClick compiler intro example

* Use a note instead

* Update src/content/learn/react-compiler/introduction.md
2025-09-03 14:42:35 -04:00
lauren
85ee6b205c Remove deprecated loremflickr placeholder images (#7968)
The previous examples used a service called loremflickr.com to link to  placeholder images. Since that service is now down, I updated them to reference placecats.com instead, which we already use in other examples as well. placecats doesn't have the same random cat feature so I roughly approximated it in the example code.

Closes #7966
2025-09-03 13:33:41 -04:00
Ricky
ff11cd2818 Add note that form actions are actions (#7964) 2025-09-02 16:53:29 -04:00
Aurora Scharff
2217f4549d Update "Deep Dive" in reusing-logic-with-custom-hooks.md with link and example of the use API (#7767)
* Update "Deep Dive" in reusing-logic-with-custom-hooks.md with link to and example of the use API

* Remove mention of Server Components when explaining the use API

* Update src/content/learn/reusing-logic-with-custom-hooks.md

Co-authored-by: Ricky <rickhanlonii@gmail.com>

* fix: Correct which lines are highlighted in code example

---------

Co-authored-by: Ricky <rickhanlonii@gmail.com>
2025-09-02 15:53:23 -04:00
Jinhyun Park
e9efd19e5a fix : typo in form component documentation (#7894)
Fix "documentatino" typo to "documentation" in comment about useOptimistic reference page.
2025-09-02 14:01:37 -04:00
Fergus Ruston
337d5eaf7d docs: minor grammar correction (#7906)
`a expensive` should be `an expensive`
2025-09-02 13:58:37 -04:00
Dejumo
afd84d136a Recommend installing @types/* as dev dependencies 2025-09-02 19:54:00 +02:00
Raghunath Prabhakar
0cc37ee979 fix: typo (#7914) 2025-09-02 13:42:32 -04:00
Deepanshu
67584b31ab Fix: grammar and add comma (#7917)
Co-authored-by: unknown <deepanshu.9dd@gmail.com~>
2025-09-02 13:42:06 -04:00
Vitor Monteiro
ca3e2718ba fix: definition typo on view transitions blog post (#7918) 2025-09-02 13:41:22 -04:00
Ricky
a4a37d8f23 Add setup to home sidebar (#7963) 2025-09-02 13:40:40 -04:00
ninamma
03a546551a Docs: update ref callback behaviour (#7927) 2025-09-02 13:26:56 -04:00
Mohammad Reza Badri
fc27b0aa9a docs: fix ordered list numbering in TypeScript with React Components section (#7941) 2025-09-02 13:00:49 -04:00
Brooks Lybrand
73a5fdd7fa docs: fix typo in update useTransition.md (#7936) 2025-09-02 12:39:02 -04:00
asimno
4d53629a66 Introduce Liverpool and Edinburgh meetup groups. (#7950) 2025-09-02 12:38:25 -04:00
Mohammad Reza Badri
04feec4582 fix(rtl): resolve RTL issues in Challenges component (#7942) 2025-09-02 12:37:21 -04:00
Mohammad Reza Badri
9ced8851e6 feat(i18n): make DocsPageFooter navigation labels translatable (#7943) 2025-09-02 12:35:20 -04:00
ramadevsign
4db5ecdda3 docs: Add Rendercon 2025 Conference (#7962) 2025-09-02 11:53:31 -04:00
Pouria Damavandi
bb998fdef6 fix broken link server-functions (#7923) 2025-09-01 14:35:15 -04:00
SeungMin Shin
ddfcf6e8a3 fix: typo in component style documentation (#7925) 2025-09-01 14:32:29 -04:00
Ricky
2774ddfa0c Add reload button, rename reset to clear (#7954) 2025-08-29 11:00:24 -04:00
lauren
19c8201d0a [compiler] Update docs on eslint-plugin-react-hooks installation (#7956)
The compiler rule is now enabled by default in 6.0.0-rc.2, so there is no longer a need to manually enable the compiler rule in user's eslint configs.
2025-08-28 18:14:32 -04:00
lauren
94a116476c [compiler][ez] Reference rc tag for install instructions (#7955)
Updates our previous RC blogpost to point people to the `rc` tag, not the specific rc version
2025-08-28 18:06:22 -04:00
lauren
9a370f2cf4 [compiler] Tweak intro section on manual memo guidance (#7953)
The previous sentence "If you are using React Compiler, useMemo, useCallback, and React.memo can be removed." was coming off a bit too strong and makes it incorrectly seem like the manual memos and compiler memos are 1:1.

Removing the sentence doesn't take anything away from this paragraph, so let's remove it to reduce confusion.
2025-08-28 16:08:37 -04:00
Aris Markogiannakis
90686d80ab Add CityJS New Delhi 2026 conference details (#7949)
* Add CityJS New Delhi 2026 conference details

* Update CityJS New Delhi date to 2025
2025-08-26 19:45:07 +05:30
Ben Amor Aymen
694aeac10e Add React Paris 2025 conference talks + Add React Paris 2026 (#7935)
Co-authored-by: Aimen Ben Amor <aimen_ben_amor@epam.com>
2025-08-26 19:27:39 +05:30
Sam Selikoff
27d86ffe6e Touch-ups to Activity (#7940) 2025-08-22 15:04:04 -07:00
Corbin Crutchley
0a74f01ee0 Add more information about event and property binding on custom elements (#7939)
Co-authored-by: Sebastian "Sebbie" Silbermann <silbermann.sebastian@gmail.com>
2025-08-22 18:13:00 +02:00
Sam Selikoff
e9a7cb1b6c Updates to Activity docs (#7884)
* Updates to Activity docs

* wip

* Updates to Activity docs:

- New intro at top of Reference
- Adds "Deferring hydration of low-priority content" section
- Move "Preventing hidden content from having unwanted side effects" section to Troubleshooting
- Removes SSR section from Troubleshooting

* useLayoutEffect + Tidying up

* Use the same color code step for "visible"

* Tidy

* Typo

* Update section on selective hydration

* Update title

* Clean up props

* Tweak wording

* wip

* wip

* wip

* remove temporary scroll restoration while working on docs

* wip

* wip
2025-08-08 08:27:36 -07:00
Chez Fre
b09221644b fix: box-shadow animation on community (#7905)
Co-authored-by: Fre <frederic.vandeborne@icapps.com>
2025-08-07 11:48:06 +01:00