Unexpected token ILLEGAL with dangerouslySetInnerHTML

programmer

I am using Symfony2 framework with reactjs for view part. I have a twig variable having html tags. So I did this - <span {{"dangerouslySetInnerHTML={{__html: ' "~content|raw~" '}}"}}></span>

But this is giving me following error

Error: Parse Error: Line 95: Unexpected token ILLEGAL
at http://localhost/url/abcd 
... ouslySetInnerHTML={{__html: &#039;&lt;p&gt;&lt;/p&gt;&lt;p&g ...

When I write something like <span {{"dangerouslySetInnerHTML={{__html: '<div>abcd</div>'}}"}}></span> , Then everything works fine. But when I use a twig variable, this error is thrown.

Paul

I would recommend using twig only to output your delimiters and the variable itself:

<span dangerouslySetInnerHTML={{ '{{' }}__html: '{{ content|raw }}' {{ '}}' }}></span>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Unexpected token ILLEGAL with dangerouslySetInnerHTML

From Dev

Unexpected token ILLEGAL on .click()

From Dev

jade conditional unexpected token illegal

From Dev

Unexpected token ILLEGAL ajax post

From Java

No visible cause for "Unexpected token ILLEGAL"

From Dev

jQuery unexpected token illegal for \n

From Dev

Unexpected Token ILLEGAL on Javascript For Loop

From Dev

Unexpected token illegal on Ajax get

From Dev

Unexpected token ILLEGAL - istanbul test _mocha

From Dev

Ajax post Uncaught SyntaxError: Unexpected token ILLEGAL

From Dev

JavaScript eval - "SyntaxError: Unexpected token ILLEGAL"

From Dev

Android webview "Uncaught SyntaxError: Unexpected token ILLEGAL"

From Dev

jQuery after() Uncaught SyntaxError: Unexpected token ILLEGAL

From Dev

Uncaught SyntaxError: Unexpected token ILLEGAL multiple string

From Dev

javascript json uncaught syntaxerror unexpected token illegal

From Dev

Android webview "Uncaught SyntaxError: Unexpected token ILLEGAL"

From Dev

error: Unexpected token ILLEGAL at Function (<anonymous>) at assertExpression

From Dev

AJAX+PHP Unexpected Illegal Token

From Dev

jQuery Change Function'Unexpected Token ILLEGAL'

From Dev

SyntaxError: Unexpected token ILLEGAL on Function Call

From Dev

Getting Unexpected Token ILLEGAL JS Error

From Dev

Jquery: Using countdownTimer getting Unexpected token ILLEGAL

From Dev

Unexpected token ILLEGAL for jquery script tag

From Dev

Unexpected token ILLEGAL when load xml object?

From Dev

SyntaxError: Unexpected token ILLEGAL in node.js

From Dev

Coffeescript unexpected token ILLEGAL, but there shouldn't be anything illegal

From Dev

how to resolve MongoDB error "SyntaxError: Unexpected token ILLEGAL"?

From Dev

Why Jest is throwing "Unexpected token ILLEGAL" when testing React component?

From Dev

Sublime Text 3 Unexpected token ILLEGAL in js files

Related Related

  1. 1

    Unexpected token ILLEGAL with dangerouslySetInnerHTML

  2. 2

    Unexpected token ILLEGAL on .click()

  3. 3

    jade conditional unexpected token illegal

  4. 4

    Unexpected token ILLEGAL ajax post

  5. 5

    No visible cause for "Unexpected token ILLEGAL"

  6. 6

    jQuery unexpected token illegal for \n

  7. 7

    Unexpected Token ILLEGAL on Javascript For Loop

  8. 8

    Unexpected token illegal on Ajax get

  9. 9

    Unexpected token ILLEGAL - istanbul test _mocha

  10. 10

    Ajax post Uncaught SyntaxError: Unexpected token ILLEGAL

  11. 11

    JavaScript eval - "SyntaxError: Unexpected token ILLEGAL"

  12. 12

    Android webview "Uncaught SyntaxError: Unexpected token ILLEGAL"

  13. 13

    jQuery after() Uncaught SyntaxError: Unexpected token ILLEGAL

  14. 14

    Uncaught SyntaxError: Unexpected token ILLEGAL multiple string

  15. 15

    javascript json uncaught syntaxerror unexpected token illegal

  16. 16

    Android webview "Uncaught SyntaxError: Unexpected token ILLEGAL"

  17. 17

    error: Unexpected token ILLEGAL at Function (<anonymous>) at assertExpression

  18. 18

    AJAX+PHP Unexpected Illegal Token

  19. 19

    jQuery Change Function'Unexpected Token ILLEGAL'

  20. 20

    SyntaxError: Unexpected token ILLEGAL on Function Call

  21. 21

    Getting Unexpected Token ILLEGAL JS Error

  22. 22

    Jquery: Using countdownTimer getting Unexpected token ILLEGAL

  23. 23

    Unexpected token ILLEGAL for jquery script tag

  24. 24

    Unexpected token ILLEGAL when load xml object?

  25. 25

    SyntaxError: Unexpected token ILLEGAL in node.js

  26. 26

    Coffeescript unexpected token ILLEGAL, but there shouldn't be anything illegal

  27. 27

    how to resolve MongoDB error "SyntaxError: Unexpected token ILLEGAL"?

  28. 28

    Why Jest is throwing "Unexpected token ILLEGAL" when testing React component?

  29. 29

    Sublime Text 3 Unexpected token ILLEGAL in js files

HotTag

Archive