提交 e8985b35 编写于 作者: T Tim Neutkens 提交者: Naoyuki Kanezawa

Add warning for multiple children in Link (#558)

* Add warning for multiple children in Link

* Add space after if

* Use proptype validation
上级 892da7eb
import React, { Component, Children } from 'react'
import React, { Component, Children, PropTypes } from 'react'
import Router from './router'
export default class Link extends Component {
......@@ -7,6 +7,13 @@ export default class Link extends Component {
this.linkClicked = this.linkClicked.bind(this)
}
static propTypes = {
children: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element
]).isRequired
}
linkClicked (e) {
if (e.target.nodeName === 'A' &&
(e.metaKey || e.ctrlKey || e.shiftKey || (e.nativeEvent && e.nativeEvent.which === 2))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册