rbi-learning / Today-I-Learned

1 stars 0 forks source link

TIL 8/24 #167

Open amatheus000 opened 4 years ago

amatheus000 commented 4 years ago

**REACT**

1. Get React structure from: https://raw.githubusercontent.com/reactjs/reactjs.org/master/static/html/single-file-example.html

2. Adding text to the DOM:


**3. To add some styles to the JSX** h1 className=red>Hello world

**4. All of the tags must be self-closed in JSX**
**5. You cannot do conditionals in JSX. You can turn it into turners or use the conditionals outside of the JSX.**
**Turner structure:** {randomNum > 0.5 ? "Heads I win" : "Tails you lose"} In this case, if the value is higher than 0.5 the “Heads I win” message will pop up, if not the “Tails you lose” message will appear. **6. Any function that returns a JSX can be used as a React Component.**
**7. Components in React are usually declared using Uppercased letters**