Skip to content

Commit

Permalink
Add example for how to use style properly
Browse files Browse the repository at this point in the history
Test Plan: jest
  • Loading branch information
sophiebits committed Nov 21, 2014
1 parent 68ba3b6 commit 1c54431
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/browser/ui/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
);
}

Expand Down
6 changes: 4 additions & 2 deletions src/browser/ui/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
);
});
});
Expand Down Expand Up @@ -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.'
);
});
});
Expand Down

0 comments on commit 1c54431

Please sign in to comment.