I have to use react
and golang
together for some reason.
However, every time I need to use {{ }}
in react, golang's turbulence overlaps with golang's template.
Is there any way that templates in golang will not work?
This should be partial and should not work as a whole because I have to use it.
Asked
Active
Viewed 287 times
1
-
3Possible duplicate of [How do I escape “{{” and “}}” delimiters in Go templates?](https://stackoverflow.com/questions/17641887/how-do-i-escape-and-delimiters-in-go-templates) – Jonathan Hall Aug 11 '17 at 07:28
-
Externalize your React stuff from your templates and use something like [go.rice](https://github.com/GeertJohan/go.rice) to embed your resources. – Markus W Mahlberg Aug 11 '17 at 07:40
1 Answers
3
Just change the delimiters on the Go side to something else before parsing (for example you could use [[ ]] ).
See the docs:

Kenny Grant
- 9,360
- 2
- 33
- 47
-
-
2Instead of `template.Execute(...)` you do `template.Delims("[[", "]]").Execute(...)` – Vincent van der Weele Aug 11 '17 at 06:58