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

Support function components via component/3 #1428

Merged
merged 2 commits into from
Apr 23, 2021

Conversation

msaraiva
Copy link
Contributor

This is the first of a set of PRs intended to improve support for components in Phoenix.

This first PR introduces a component/3 macro that should be used to define stateless components based on pure functions. The goal is to be able to create stateless components that can:

  1. Be used in controller-based dead views, including layouts
  2. Include live components in their inner block
  3. Be diff-tracking-aware

The component/3 macro along with the changes in phoenixframework/phoenix_html#331 are requirements for the next PR which will introduce an HTML tokenizer and engine that will be able to parse an extended version of EEX called HEEX. This new format will allow injecting components in an HTML-like style (similar to React, Vue, Surface, ...). In addition, it will statically validate the structure of the template, raising errors on common mistakes like unclosed/unmatched tags.

The first version of the HTML tokenizer and engine is already done and will be submitted for review as soon as we have this one merged.

Cheers.

@josevalim josevalim merged commit 3356970 into phoenixframework:master Apr 23, 2021
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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

Successfully merging this pull request may close these issues.

None yet

2 participants