File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -395,4 +395,37 @@ module.exports = {
395395 } ,
396396 ] ,
397397 } ,
398- } ;
398+ } ;
399+
400+
401+
402+ // BASICS
403+
404+ // use those import everytime! They are needed in all examples
405+ import React from "react" ;
406+ import ReactDOM from "react-dom" ;
407+
408+
409+ // write JSX elements just as HTML
410+ const h1 = < h1 > React JS</ h1 > ;
411+
412+ // define element attribute just as in HTML
413+ const a = < a href = "#0" > What a link!</ a > ;
414+
415+ // multiline element are possible using parenthesis ()
416+ const ah1 = (
417+ < a href = "#0" >
418+ < h1 >
419+ What a big link!
420+ </ h1 >
421+ </ a >
422+ ) ;
423+
424+ // a JSX expression must have exactly one outermost element
425+ // good habit is to have a <div>, or <> (<React.Fragment>, <Fragment>) wrapping everything
426+ const blog = (
427+ < div >
428+ < h1 > Main title</ h1 >
429+ < p > Subtitle</ p >
430+ </ div >
431+ ) ;
You can’t perform that action at this time.
0 commit comments