How to render accents in ReactJs?

后端 未结 3 1407
陌清茗
陌清茗 2020-12-20 23:27

I\'m trying render an element which has an accent character using ReactJS and JSX, but it\'s not returning what I wanted.

My JSX:

var Or         


        
3条回答
  •  盖世英雄少女心
    2020-12-21 00:23

    What you see, Orçamento, it's a result of a UTF-8 byte array being rendered in ASCII, probably codepage ISO 8859-1.

    ReactJS doesn't support non-ASCII characters within HTML.

    Try this:

    var Orcamento = React.createClass({
        render: function() {
            return (
                

    { 'Orçamento' }

    ; ); } });

    Or simply replace orçamento by Orçamento.

    This is well explained in the JSX gotchas.

提交回复
热议问题