Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conditional logic in Dream templates #321

Open
mvolkmann opened this issue Apr 2, 2024 · 2 comments
Open

conditional logic in Dream templates #321

mvolkmann opened this issue Apr 2, 2024 · 2 comments

Comments

@mvolkmann
Copy link

I don't see any examples that show how to conditionally include elements in a template. Is that possible? If so, what is the syntax>

@maxRN
Copy link
Contributor

maxRN commented Sep 6, 2024

@mvolkmann Not sure if this is still relevant, but in case you haven't seen: There are examples for using conditional logic with OCaml and Reason

If you wanted to replicate the React idiom of

<body>
  {enabled && <div>parameter is enabled</div>}
</body>

you could do it like this

<body>
% if enabled then begin
  <div>parameter is enabled</div>
% end;
</body>

Note that it's important that the %s are the first character in the line.

@aantron
Copy link
Owner

aantron commented Sep 6, 2024

Thanks @maxRN! My apologies, I've been super behind on issues, catching up slowly, and this is very helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants