4
const { module } = this.props;

return(
    <div className="Card">
        <Link to=`/${module}/detail`></Link>
    </div>
 )

What's wrong with above syntax? I got error of JSX value should be either an expression or a quoted JSX text

1
  • Please note that what you quoted is not valid JavaScript (even when correct, as in Reagan Cuthbertson's answer). Do also tag such questions with react-jsx in the future. Commented Apr 6, 2017 at 4:23

1 Answer 1

6

When using javascript in JSX you need to wrap it in curly braces. The template literal you are using within the value of the to attribute on your Link component needs the curly braces.

return (
    <div className="Card">
        <Link to={`/${module}/detail`}></Link>
    </div>
 );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.