ruanyf / react-demos Goto Github PK
View Code? Open in Web Editor NEWa collection of simple demos of React.js
a collection of simple demos of React.js
Hi,
Curious if you are accepting PR's for updated demo's using babel.js? or if you plan to update repo using babel.js
阮老师你好。我想请教下这一段里面的this.isMounted的作用。
Lines 20 to 30 in 15a5be3
看README的描述
did
methods which are called right after something happens.
componentDidMount
这个钩子调用的时候 this.isMounted
应该总是为true
吧。那么这个判断是不是多余的。
In demo #7,
You can just use
this.refs.myTextInput
No need to use
ReactDOM.findDOMNode(this.refs.myTextInput)
Please check: (https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode)
请问在Demo11、12,使用jquery发起的ajax请求,是json请求不是jsonp请求,为什么同源策略不起作用,浏览器仍正常发送
can have chinese version? thx want can have chinese.
我感觉是比较基础的使用方法把,为啥有这么多star 不是很理解 小白一枚
Should be as below:
git clone https://github.com/ruanyf/react-demos.git
寻找对react源码感兴趣的朋友。如果对 react 源码感兴趣的朋友,欢迎一起共建。如果有什么好的外文需要翻译,也可以加到 仓库read.me 中的TODO列表。或者觉得什么文章好,也欢迎提 PR 收录进来。希望能一起对文章质量把关,一起共建社区最好的 react 源码生态环境。
Failed at the [email protected] build script 'babel -d . src/'.
In Demo05, you mentioned,
Please be minded that only if the component has more than one child node,
you could take this.props.children as an array,
otherwise this.props.children.map throws a TypeError.
It would be nice if you remind reader that there's a function called React.Children.map which can deal with this problem well.
More info https://facebook.github.io/react/docs/top-level-api.html#react.children
After I git clone the ssh from github page and successfully installed the package, and I can open the file folder in Atom, I can not use the $npm install -g babel. I'm using windows 10 system.
The error message goes like this:
User\Document\react-demos $npm install -g babel
'$npm' is not recognized as an internal or external command,
operable program or batch file.
New to JavaScript but rush to a final. Thanks in advance for your reply!
//wrong
var HelloMessage = React.createClass({ // should be helloMessage
render: function() {
return <h1>
Hello {this.props.name}
</h1><p>
some text
</p>;
}
});
// correct
var HelloMessage = React.createClass({
render: function() {
return <div>
<h1>Hello {this.props.name}</h1>
<p>some text</p>
</div>;
}
})
I read your article.
It's very cool.
But maybe something is incorrect in the Demo04: Define a component
Maybe you want to give an example to show that the first lower case will generate an error.
But in your article, two examples are both start with the BIG H.
I feel that isn't your original proposal
输出是123呢不是那个报错的Warning: Failed propType: Invalid prop title
of type number
supplied to MyTitle
, expected string
求教
作为一个英语不是太好的人,表示阅读中文比起英语阅读起来更快,希望能有中文的
mac os 下用 chrome 打开正常,用 safari 就没有显示.
I tried to import the corresponding css file to the LogIn component like this:
import '../css/login.css';
import React from 'react';
const LogIn = React.createClass(.......)
But encountered with this error:
C:\Users\username\Desktop\APPStore>node server.js
module.js:471
throw err;
^
Error: Cannot find module '../css/login.css'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\LIN SIYIN\Desktop\AppStore\APPStore\components\LogIn.js:5:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
How can I solve it? Thanks a lot!
And my other question is how can I reference to another component in the button onClick() event? The reason Why I am trying to do this is because I want to direct to another page when click the button.
ssss
It would be good to have a build setup for this project, where code is linted and deployed to the github pages.
I work on this open-source build tool called earthly and I could do the work to set this up with GitHub Actions and earthly. Would that be useful?
demo13中react和react-dom引入失败,fb链接已失效,将build中的react和react-dom放入src中,路径为‘./react.xxx.js’
,一直提示: get http://localhost:3000/react-0.14.0.js net::ERR_ABORTED。不知道什么原因
make seperate branch for every demo
在第三步报错了,
demo13/src/server.js:19
<body>
^
SyntaxError: Unexpected token <
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.