mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #1520 from syranide/ediblechildren
Warn against contentEditable with children props
This commit is contained in:
@@ -60,6 +60,16 @@ function assertValidProps(props) {
|
||||
props.children == null || props.dangerouslySetInnerHTML == null,
|
||||
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
|
||||
);
|
||||
if (__DEV__) {
|
||||
if (props.contentEditable && props.children != null) {
|
||||
console.warn(
|
||||
'A component is `contentEditable` and contains `children` managed by ' +
|
||||
'React. It is now your responsibility to guarantee that none of those '+
|
||||
'nodes are unexpectedly modified or duplicated. This is probably not ' +
|
||||
'intentional.'
|
||||
);
|
||||
}
|
||||
}
|
||||
invariant(
|
||||
props.style == null || typeof props.style === 'object',
|
||||
'The `style` prop expects a mapping from style properties to values, ' +
|
||||
|
||||
Reference in New Issue
Block a user