-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
細かな修正: providerとrouteをまとめる, jsDocの追加 #86
Conversation
frontend/src/utils/lazyImport.ts
Outdated
/** | ||
* コンポーネントの遅延読み込み | ||
* | ||
* @param {() => Promise<I>} factory | ||
* @param {K} name | ||
*/ | ||
export const lazyImport = < | ||
T extends React.ComponentType<FC>, | ||
I extends { [K2 in K]: T }, | ||
K extends keyof I, | ||
>( | ||
factory: () => Promise<I>, | ||
name: K, | ||
): I => { | ||
return Object.create({ | ||
[name]: React.lazy(() => factory().then(module => ({ default: module[name] }))), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この遅延読み込みって具体的にどんなことしてるかわかる?
どういう時に使ったらいいのかわからないから、折角JSDoc書いてるんだしその説明も欲しいな
こういう使い方とかぱっと見わからないやつはJSDocの@example構文使うといいよ!
↓みたいな書き方する
/**
* hogehgoe
* @return {*} {UseHoge}
* @example
```js
const hoge = useHoge() // テスト文章
```
*/
あと普通に中のコード何してるのかいまいちわからなくて気になるから、参考リンクあるなら欲しいw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React.lazyの遅延読み込みはdefault exportにしか対応してなくて、それが嫌だなってことでnamed exportに対応させてるだけ!
facebook/react#14603
JSDoc追加する!ありがとう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あ〜〜〜〜なるほど!
Suspence内で使うのね!前教えてくれた本の最新版か、買うわ
ありがとう!
実装の概要
Trello #84
Closes #84
目的
レビューして欲しいところ
不安に思っていること
拡張入れたけど意外とjsDoc推論してくれなくて雰囲気で書いてる
スケジュール
関連
今後のタスク