@samitouri / QOS-React-2 / commits / 1c5443175c

Add example for how to use `style` properly

Test Plan: jest

Ben Alpert committed Nov 21, 2014 at 02:23 UTC 1c5443175cf55addb63ee04a00a0939e9bbb0db6
2 files changed +6 -3
src/browser/ui/ReactDOMComponent.js
+2 -1
@@ -69,7 +69,8 @@ function assertValidProps(props) {
69 invariant(
70 props.style == null || typeof props.style === 'object',
71 'The `style` prop expects a mapping from style properties to values, ' +
72 - 'not a string.'
72 + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
73 + 'using JSX.'
74 );
75 }
76
src/browser/ui/__tests__/ReactDOMComponent-test.js
+4 -2
@@ -353,7 +353,8 @@ describe('ReactDOMComponent', function() {
353 mountComponent({ style: 'display: none' });
354 }).toThrow(
355 'Invariant Violation: The `style` prop expects a mapping from style ' +
356 - 'properties to values, not a string.'
356 + 'properties to values, not a string. For example, ' +
357 + 'style={{marginRight: spacing + \'em\'}} when using JSX.'
358 );
359 });
360 });
@@ -398,7 +399,8 @@ describe('ReactDOMComponent', function() {
399 React.render(<div style={1}></div>, container);
400 }).toThrow(
401 'Invariant Violation: The `style` prop expects a mapping from style ' +
401 - 'properties to values, not a string.'
402 + 'properties to values, not a string. For example, ' +
403 + 'style={{marginRight: spacing + \'em\'}} when using JSX.'
404 );
405 });
406 });