學react

常用軟體,程式語言的筆記和疑問
Forum rules
盡量做到:
每一個貼子都精心編輯;
每一個疑問都得到解答。
ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

react CSS

Post by ejsoon » 2018 May 25, 15:43


ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

render之前的map䋸環

Post by ejsoon » 2018 May 29, 15:40

const listItems = numbers.map((number) =>
<li>{number}</li>
);

ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

支持事件與阻止事件

Post by ejsoon » 2018 May 30, 09:56

支持事件

event.preventDefault();

ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

Using Axios with React

Post by ejsoon » 2018 May 31, 11:53



ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

這句用在name也是變量的情況

Post by ejsoon » 2018 May 31, 14:45

this.setState({
[name]: value
});

ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

Re: 哈哈哈學react路由(本貼爲新版本)

Post by ejsoon » 2018 May 31, 17:51

ejsoon wrote:
2018 May 24, 10:33
react-router-dom

研究近一週,稍懂:

Code: Select all

// index.js
ReactDOM.render(
		 <Router>
			<div>
				<Home />
				<Switch>
					<Route path="/rend" component={Rend}/>
					<Route path="/repay" component={Repay}/>
					<Route path="/me" component={Me}/>
				</Switch>
			</div>
		 </Router>
	, document.getElementById('root'));

// Home.js
class Home extends Component {
  render() {
    return (
      <div className="Home">
				{this.props.children}
        <div className="btnav">
					<div className="btnavchild">
						<NavLink activeClassName="selected" to="/rend">
						借款
						</NavLink>
					</div>
					<div className="btnavchild">
						<NavLink activeClassName="selected" to="/repay">
						还款
						</NavLink>
					</div>
					<div className="btnavchild">
						<NavLink activeClassName="selected" to="/me">
						我的
						</NavLink>
					</div>
        </div>
      </div>
    );
  }
}

組件中的子路由直接上Route,不要再套Router了。坑啊!

ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

react改端口

Post by ejsoon » 2018 Jun 04, 10:18

package.json:`
"start": "set PORT=3036 && react-scripts start",

ejsoon
Site Admin
Posts: 3533
Joined: 2016 Jan 10, 22:15

中文文檔

Post by ejsoon » 2018 Jun 20, 16:40



Post Reply