Skip to content

Using template strings throws an error on Safari: Invalid character '`' #4143

@josdejong

Description

@josdejong

Using template strings in jsx files seems to be not supported by Safari because it doesn't like the backtick character '`'.

On Safari 8, the following code:

var container = document.getElementById('app');
var name = 'user';
var msg = `Hello ${name}!`;
React.render(<div>{msg}</div>, container);

Throws an error:

SyntaxError: Invalid character: '`' (line 3)

See this jsbin: http://jsbin.com/vurezi/edit?html,js,output

One solution for this is not to use in-browser transformation (which is good practice anyway). But does anybody know a workaround for this? I tried specifying charset="utf-8" in the jsx script tags but that didn't help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions