You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useAsyncBoundaryContext 훅에서 useContext(AsyncBoundaryContext) 값이 null 인 경우 { resetKey: null, reset: () => {} }; 를 반환하는걸 봤습니다. 이렇게 한 이유가 뭔지 궁금합니다!
이 값이 null인 경우가 AsyncBoundaryProvider로 감싸지 않았을 경우 밖에 생각나지 않는데 그렇다면 AsyncBoundaryProvider 내부에서만 useAsyncBoundaryContext를 사용할 수 있다는 메시지를 던지는게 좋지 않나? 하는 생각입니다!
만약 그런 처리 없이 사용했을 때 필요한 컨텍스트가 없으면 { resetKey: null, reset: () => {} } 값을 받아 사용하게 되는데 디버깅에 어려움을 주게 되지 않을까 하는 생각이 들었습니다.
exportfunctionuseAsyncBoundaryContext(){constcontext=useContext(AsyncBoundaryContext);if(!context){assert("useAsyncBoundaryContext should be used in wrapped Component with AsyncBoundaryProvider");}returncontext;}
Additional context
만약 에러를 던지지 않고 더미 값을 반환하는 동작이 의도되었다면 그 이유가 궁금합니다!
The text was updated successfully, but these errors were encountered:
Package Scope
Package name: react/async-boundary/src/provider/AsyncBoundaryProvider.tsx
Overview
useAsyncBoundaryContext
훅에서useContext(AsyncBoundaryContext)
값이null
인 경우{ resetKey: null, reset: () => {} };
를 반환하는걸 봤습니다. 이렇게 한 이유가 뭔지 궁금합니다!이 값이
null
인 경우가AsyncBoundaryProvider
로 감싸지 않았을 경우 밖에 생각나지 않는데 그렇다면AsyncBoundaryProvider
내부에서만useAsyncBoundaryContext
를 사용할 수 있다는 메시지를 던지는게 좋지 않나? 하는 생각입니다!만약 그런 처리 없이 사용했을 때 필요한 컨텍스트가 없으면
{ resetKey: null, reset: () => {} }
값을 받아 사용하게 되는데 디버깅에 어려움을 주게 되지 않을까 하는 생각이 들었습니다.Describe the solution you'd like
기존
변경
Additional context
만약 에러를 던지지 않고 더미 값을 반환하는 동작이 의도되었다면 그 이유가 궁금합니다!
The text was updated successfully, but these errors were encountered: