This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| //luu y createClass phai viet thuong chu create | |
| var redPanda = { | |
| src: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-owl.jpg', | |
| alt: 'Red Panda', | |
| width: '200px' | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| //luu y createClass phai viet thuong chu create | |
| var QuoteMaker = React.createClass({ | |
| render: function(){ | |
| return ( | |
| <blockquote> | |
| <p> | |
| HeyKorean Training - React Native |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| var componentBlueprint = { | |
| render: function() { | |
| return <h1>Hello world</h1>; | |
| } | |
| }; | |
| var MyComponentClass = React.createClass(componentBlueprint); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| // React.createClass co 1 tham so, bat buoc phai la js object | |
| var MyComponentClass = React.createClass({ | |
| render: function () { | |
| return <h1>Hello world</h1>; | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var React = require('react'); | |
| var ReactDOM = require('react-dom'); | |
| var MyComponentClass = React.createClass(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var React = require('react');// tra ve javascript object de su dung o ben duoi, returned object nay goi la React library | |
| //Chung ta da su dung cac methods cua React library: | |
| // do la React.createElement.Recall that when a JSX element is compiled, it transforms into a React.createElement() call. | |
| //For this reason, you have to require the React library and save it in a variable named React, before you can use any JSX at all. | |
| //React.createElement must be available in order for JSX to work. | |
| var ReactDOM = require('react-dom'); | |
| //require('react-dom') gan giong voi require('react'). | |
| //No cung tra ve mot javascript object, bao gom cac phuong thuc lien quan den React | |
| //Tuy nhien cac phuong thuc tra ve boi require('react-dom') la de tuong tac voi DOM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| // judgmental will be true half the time. | |
| var MyComponentClass = React.createClass({ | |
| render : function() { | |
| return <h1>Hello World</h1>; | |
| } | |
| }); | |
| ReactDOM.render(<MyComponentClass/> , document.getElementById('root')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| // judgmental will be true half the time. | |
| var people = ['Rowe', 'Prevost', 'Gare']; | |
| var peopleLIs = people.map(function(person){ | |
| // return statement goes here: | |
| return <li>{person}</li>; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| // judgmental will be true half the time. | |
| var judgmental = Math.random() < 0.5; | |
| var favoriteFoods = ( | |
| <div> | |
| <h1>My Favorite Foods</h1> | |
| <ul> | |
| <li>Sushi Burrito</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| // import App from './App'; | |
| function randomImage () { | |
| // This function will randomly return either 'heads' or 'tails'. | |
| return Math.random() < 0.5 ? 'heads' : 'tails'; | |
| } | |
| var pics = { | |
| kitty: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-kitty.jpg', |