-
Notifications
You must be signed in to change notification settings - Fork 141
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
chore: useSectionWrapperのロジックを調整 #5411
base: master
Are you sure you want to change the base?
Conversation
commit: |
224f80c
to
5dc79a7
Compare
5dc79a7
to
d51fc61
Compare
<Component {...props} ref={ref} className={styles} /> | ||
</Wrapper> | ||
) | ||
if (Wrapper) { |
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.Fragmentの実行は単純なdivをレンダリングするより重いらしく、条件分岐することにしました。
元のロジックでは常になにか処理が必要な印象を受けてしまうので、 必要な場合のみ
であることがわかるというメリットもあります
@@ -5,14 +5,15 @@ import { SectioningFragment } from './SectioningContent' | |||
|
|||
type ComponentType = string | React.ComponentType<any> | |||
|
|||
const sectioningContents = ['article', 'aside', 'nav', 'section'] | |||
const SECTIONING_CONTENTS_REGEX = /^(article|aside|nav|section)$/ |
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.
配列をチェックするより、正規表現一発でやるほうが早いため切り替えました
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.
LGTM!
関連URL
概要
変更内容
確認方法