Skip to content

Instantly share code, notes, and snippets.

@zenius
Last active May 2, 2019 13:10
Show Gist options
  • Save zenius/b6574020ee02448d362ce92b9b6e9559 to your computer and use it in GitHub Desktop.
Save zenius/b6574020ee02448d362ce92b9b6e9559 to your computer and use it in GitHub Desktop.
const element = <Welcome name="Sara" />;
When React sees an element representing a *user-defined component*,
it passes *JSX attributes* to this component as a single object. We call this object *“props”*.
When an element type starts with a lowercase letter, it refers to a built-in component like <div> or <span>
and results in a string 'div' or 'span' passed to React.createElement.
**Types that start with a capital letter like <Foo /> compile to React.createElement(Foo)**
and correspond to a component defined or imported in your JavaScript file.
All React components must act like pure functions with respect to their props. - React Docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment