Skip to content

Commit 822543f

Browse files
authored
Merge branch 'master' into master
2 parents 0bfa6ba + 8fcfafa commit 822543f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

content/docs/code-splitting.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ const App = () => (
225225

226226
## Named Exports {#named-exports}
227227

228-
`React.lazy`는 현재 default exports만 지원합니다. named exports를 사용하고자 한다면 default로 이름을 재정의한 중간 모듈을 생성할 수 있습니다. 이렇게 하면 treeshaking이 계속 동작하고 사용하지 않는 컴포넌트는 가져오지 않습니다.
228+
`React.lazy`는 현재 default exports만 지원합니다. named exports를 사용하고자 한다면 default로 이름을 재정의한 중간 모듈을 생성할 수 있습니다. 이렇게 하면 tree shaking이 계속 동작하고 사용하지 않는 컴포넌트는 가져오지 않습니다.
229229

230230
```js
231231
// ManyComponents.js

content/docs/hooks-faq.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -809,13 +809,10 @@ function Image(props) {
809809

810810
// ✅ IntersectionObserver is created lazily once
811811
function getObserver() {
812-
let observer = ref.current;
813-
if (observer !== null) {
814-
return observer;
812+
if (ref.current === null) {
813+
ref.current = new IntersectionObserver(onIntersect);
815814
}
816-
let newObserver = new IntersectionObserver(onIntersect);
817-
ref.current = newObserver;
818-
return newObserver;
815+
return ref.current;
819816
}
820817

821818
// When you need it, call getObserver()

0 commit comments

Comments
 (0)