React.js: Difference between revisions

From Objectif Client Inc
Jump to navigation Jump to search
(Created page with "== Installation == npm install -g create-react-app ==You first application== ===Create an application=== create-react-app my-app ===Running an appication=== cd my-app npm s...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Installation ==
== Installation ==
<syntaxhighlight lang="bash">
npm install -g create-react-app
npm install -g create-react-app
</syntaxhighlight>


==You first application==
==You first application==
===Create an application===  
===Create an application===  
<syntaxhighlight lang="bash">
create-react-app my-app
create-react-app my-app
</syntaxhighlight>


===Running an appication===
===Running an appication===
<syntaxhighlight lang="bash">
cd my-app
cd my-app
npm start
npm start
</syntaxhighlight>
== Code ==
=== Elements ===
* React.createElement(ReactClass,props,children)
<syntaxhighlight lang="js">
const root = React.createElement(
  "div",
  {},
  React.createElement(
    "h1",
    {},
    "Hello, world!",
    React.createElement(
      "a",
      { href: "mailto:tome@email.com" },
      React.createElement("h1", {}, "React In Action"),
      React.createElement("em", {}, "...another children")
    )
  )
);
</syntaxhighlight>

Latest revision as of 01:08, 27 November 2017

Installation

npm install -g create-react-app

You first application

Create an application

create-react-app my-app

Running an appication

cd my-app
npm start

Code

Elements

  • React.createElement(ReactClass,props,children)
const root = React.createElement(
  "div",
  {},
  React.createElement(
    "h1",
    {},
    "Hello, world!",
    React.createElement(
      "a",
      { href: "mailto:tome@email.com" },
      React.createElement("h1", {}, "React In Action"),
      React.createElement("em", {}, "...another children")
    )
  )
);