Created
December 24, 2020 00:35
-
-
Save kwoncharles/7b8ee145d09af5e9076e18f5fb6860ec to your computer and use it in GitHub Desktop.
Revisions
-
kwoncharles created this gist
Dec 24, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ function Page() { return ( <Layout> {/* Tab의 상태는 WithTab 내부로 추상화 */} <WithTab items={tabItems}> {selectedTab => { switch (selectedTab) { case 'LOGIN': return <Login /> case 'JOIN': return <Join /> case 'HOME': default: return <Home /> } }} </WithTab> </Layout> ) } // 꼭 children으로만 함수를 전달할 필요는 없습니다 :) function Page() { return ( <Layout> <WithTab items={tabItems} renderContent={selectedTab => { switch (selectedTab) { case 'LOGIN': return <Login /> case 'JOIN': return <Join /> case 'HOME': default: return <Home /> } }} /> </Layout> ) }