As a newcomer to Retool, I've often misused {{ }}. Knowing when these are required or not allowed can save enormous amounts of debugging time. A Doc page listing when the double curly braces are required or not allowed would save newcomers a lot of frustration, I think.
Absolutely valid, @haj. We've shared this feedback with the docs team. I've personally seen this cause confusion with other users, so a doc like this would definitely be helpful!
Maybe I can even write up a quick post in our Tips & Tricks category. Have you run into any specific gotchas that I can add below?
In general, use double curlies:
- When referencing anything Retool specific, e.g.
{{ query1.data }}
or{{ text1.value }}
- When writing Javascript, e.g. in a Text component's value field,
{{ checkbox1.value ? 'yes' : 'no'}}
An exception:
- Inside JS queries, double curlies should NOT be used
Some notes:
- The space between the curlies and the text is optional! e.g.
{{query1.data}}
is the same as{{ query1.data }}
- Triple curlies can occasionally cause problems, so a space might be helpful. e.g.
{{{'key':123}}}
might cause errors. Try{{ {'key': 123} }}
instead
1 Like