Function:
Passing the data to the components.
Situation 1:
access data to class components.
Situation 2:
access data to functional components.
//App.js
import logo from './logo.svg';import './App.css';import { Component } from 'react';class Body extends Component{ //S1render(){return(<aclassName="App-link"href="https://reactjs.org"target="_blank"rel="noopener noreferrer">{this.props.note}</a>)}}const Header = props=>( //S2<p> {props.title} </p>)function App() {return (<div className="App"><header className="App-header"><img src={logo} className="App-logo" alt="logo" /><Header title="Hello"/><p>Edit <code>src/App.js</code> and save to reload.</p><Body note={"Learn React"}></Body></header></div>);}export default App;
Steps:
1. Open terminal and input
node -v
npm -v
npx -v
check the version of node.js, npm and npx . If you haven’t install those dependencies please install them…
拼接字符串有concat() 和 使用“+”两个方法
1、使用字符串的concat()方法
let stringValue = "hello";
let result = stringValue.concat("wo …
第一章:
完整的JS包括:ECMAscript, DOM , BOM
定义: ECMAscript: ECMAscript 是ECMA-262定义的语言,并不局限于浏览器。这门语言没有输入和输出之类的方法。它 …
详解Get与Post的区别
一提到Get与Post的区别,大多数人可能第一个想到的是Post更安全,get 比post传输长度更小等。但是这些都太不准确了。
get 和 post 都是基于HTTP的请求方法。 …