React js codecademy course
💖It was developed by engineers at Facebook.
💖Here are just a few of the reasons why people choose to program with React:
1.React is fast.
2.React is modular.
3.React is scalable.
4.React is flexible.
5. React is popular.
What is JSX?
💖JSX is not valid JavaScript. Web browsers can't read it!
💖 It was written to be used with React. JSX code looks a lot like HTML.
JSX Elements
💖A basic unit of JSX is called a JSX element.💖Here's an example of a JSX element:
<h1>Hello world</h1>
💖This JSX element looks exactly like HTML!JSX elements and their surroundings
💖JSX elements are treated as JavaScript expressions.
💖They can go anywhere that JavaScript expressions can go.
💖That means that a JSX element can be saved in a variable, passed to a function, stored in an object or array...you name it.
💖Here's an example of a JSX element being saved in a variable:
const navBar = <nav>I am a nav bar</nav>;
Attributes in JSX
💖A JSX attribute is written using HTML-like syntax: a name, followed by an equals sign, followed by a value.
💖The value should be wrapped in quotes, like this
my-attribute-name="my-attribute-value"
No comments:
Post a Comment