Render curly braces as plain text in React/JSX

前端 未结 3 438
再見小時候
再見小時候 2020-12-06 16:13

I am having problems displaying { and } as text in React. I saw a similar question that someone said to wrap the entire string in curlies, but this is not working:



        
3条回答
  •  余生分开走
    2020-12-06 16:37

    I think the issue is just a typo. You have this:

    return (

    {"{{}}"}

    )

    but you need this (note the closing p tag instead of another opening one):

    return (

    {"{{}}"}

    )

提交回复
热议问题