/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow */ import * as React from 'react'; import {useRef, useState} from 'react'; const Counter = () => { const [count, setCount] = useState(0); return (

Count: {count}

); }; function DialogComponent() { const dialogRef = useRef(null); const openDialog = () => { if (dialogRef.current) { dialogRef.current.showModal(); } }; const closeDialog = () => { if (dialogRef.current) { dialogRef.current.close(); } }; return (

Dialog Content

); } function RegularComponent() { return (

Regular Component

); } export default function TraceUpdatesTest(): React.Node { return (

TraceUpdates Test

Standard Component

Dialog Component (top-layer element)

How to Test:

  1. Open DevTools Components panel
  2. Enable "Highlight updates when components render" in settings
  3. Click increment buttons and observe highlights
  4. Open the dialog and test increments there as well
); }