Add example for how to use style properly

Test Plan: jest
This commit is contained in:
Ben Alpert
2014-11-21 02:23:46 -08:00
parent 68ba3b6d18
commit 1c5443175c
2 changed files with 6 additions and 3 deletions

View File

@@ -69,7 +69,8 @@ function assertValidProps(props) {
invariant(
props.style == null || typeof props.style === 'object',
'The `style` prop expects a mapping from style properties to values, ' +
'not a string.'
'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
'using JSX.'
);
}

View File

@@ -353,7 +353,8 @@ describe('ReactDOMComponent', function() {
mountComponent({ style: 'display: none' });
}).toThrow(
'Invariant Violation: The `style` prop expects a mapping from style ' +
'properties to values, not a string.'
'properties to values, not a string. For example, ' +
'style={{marginRight: spacing + \'em\'}} when using JSX.'
);
});
});
@@ -398,7 +399,8 @@ describe('ReactDOMComponent', function() {
React.render(<div style={1}></div>, container);
}).toThrow(
'Invariant Violation: The `style` prop expects a mapping from style ' +
'properties to values, not a string.'
'properties to values, not a string. For example, ' +
'style={{marginRight: spacing + \'em\'}} when using JSX.'
);
});
});