question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 10 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SanderSpiescommented, Nov 4, 2013

This is expected behaviour. Please use prop={number} instead of prop=number.

On Monday, November 4, 2013, John Wu wrote:

<!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>

{this.props.firstAdder}+{this.props.secondAdder}={this.props.firstAdder+this.props.secondAdder}

</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.

— Reply to this email directly or view it on GitHubhttps://github.com/facebook/react/issues/468 .

0reactions
bhargavgunreddycommented, Jan 31, 2014

thanks man 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found