exception raised when pass number to props
See original GitHub issue<!DOCTYPE html>
<html>
<head>
<title>Hello React</title>
<script src="react-0.5.1/build/react.min.js"></script>
<script src="react-0.5.1/build/JSXTransformer.js"></script>
</head>
<body>
<script type="text/jsx">
/** @jsx React.DOM */
var MyComponent = React.createClass({
render: function(){
return (
<div><p>{this.props.firstAdder}+{this.props.secondAdder}={this.props.firstAdder+this.props.secondAdder}</p></div>
);
}
});
var app = <MyComponent firstAdder=1 secondAdder=2/>;
React.renderComponent(app, document.body);
</script>
</body>
</html>
Two numbers were passed to props, but with exception raised Uncaught Error: Parse Error: Line 10: XJS value should be either an expression or a quoted XJS text
.
Issue Analytics
- State:
- Created 10 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React - Create Error Checking for Props in Components
Show activity on this post. Consider simply throwing an exception: export default function Component (props){ if (typeof(props. number) !=
Read more >10.2 Exceptions - Racket Documentation
Raises an exception, where v represents the exception being raised. The v argument can be anything; it is passed to the current exception...
Read more >Passing numbers as Props to a Component in React
To pass a number as props to a component in React, wrap the number in curly braces, e.g. <Child num={42} /> . All...
Read more >PROP 14. Exception Handling Flashcards - Quizlet
Exception : any unusual event, erroneous or not, that is detectable by either hardware or software and that may require special processing.
Read more >Texas Proposition 2, Increased Homestead Exemption for ...
A "no" vote opposed increasing the homestead exemption for school district ... Ballotpedia tracked two homestead exemptions passed in Texas since 1997.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is expected behaviour. Please use prop={number} instead of prop=number.
On Monday, November 4, 2013, John Wu wrote:
thanks man 😃