File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
code/03 React Essentials/01-starting-project/src Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ function App() {
1414 console . log ( selectedTopic ) ;
1515 }
1616
17+ let tabContent = < p > Please select a topic!</ p > ;
18+
19+ if ( selectedTopic ) {
20+ tabContent = (
21+ < div id = "tab-content" >
22+ < h3 > { EXAMPLES [ selectedTopic ] . title } </ h3 >
23+ < p > { EXAMPLES [ selectedTopic ] . description } </ p >
24+ < pre >
25+ < code > { EXAMPLES [ selectedTopic ] . code } </ code >
26+ </ pre >
27+ </ div >
28+ ) ;
29+ }
30+
1731 return (
1832 < div >
1933 < Header />
@@ -41,14 +55,8 @@ function App() {
4155 < TabButton onSelect = { ( ) => handleSelect ( "props" ) } > Props</ TabButton >
4256 < TabButton onSelect = { ( ) => handleSelect ( "state" ) } > State</ TabButton >
4357 </ menu >
44- < div id = "tab-content" >
45- < h3 > { EXAMPLES [ selectedTopic ] . title } </ h3 >
46- < p > { EXAMPLES [ selectedTopic ] . description } </ p >
47- < pre >
48- < code > { EXAMPLES [ selectedTopic ] . code } </ code >
49- </ pre >
50- </ div >
5158 </ section >
59+ { tabContent }
5260 </ main >
5361 </ div >
5462 ) ;
You can’t perform that action at this time.
0 commit comments