Skip to content

Commit 0e70db4

Browse files
author
Kevin Logan
committed
Note about updating
1 parent 5acef43 commit 0e70db4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/app/header/header-wrapper.component.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export class HeaderWrapperComponent
5454
// I've decided to ignore it since the render is efficient
5555
// If you call render on the same root more than once, React will update the DOM as necessary to reflect the latest JSX you passed. React will decide which parts of the DOM can be reused and which need to be recreated by “matching it up” with the previously rendered tree. Calling render on the same root again is similar to calling the set function on the root component: React avoids unnecessary DOM updates.
5656
// see https://react.dev/learn/preserving-and-resetting-state
57+
// note: I attempted to avoid it in https://github.com/aligneddev/angular-plus-react/commit/8d39025cb099d0f5ca3ee9026bcefb5cd5e942ec, but updating didn't work so I reverted it
58+
// lesson: use the document.dispatchEvent to change values
5759
const root = createRoot(this.containerRef.nativeElement as HTMLElement);
5860
root.render(
5961
<React.StrictMode>

0 commit comments

Comments
 (0)