Skip to content

Minor clarifications to TwigComponent doc examples #242

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

Closed
wants to merge 1 commit into from

Conversation

allejo
Copy link
Contributor

@allejo allejo commented Jan 24, 2022

Q A
Bug fix? no
New feature? no
Tickets n/a
License MIT

The examples I've touched sounded a bit misleading to me at first comparing to the Live Component package. Having something available as {{ message }} isn't possible since an error is thrown since it's not a property nor does it exist in the mount() method. I feel like examples should just make the this variable very clear.

@weaverryan
Copy link
Member

Hi there!

Ah, this is tricky. The reason the documentation doesn't work is that you CAN now access local variables, but that feature has not been released yet :/. I think what we SHOULD do is clarify the version this stuff is available in. So what we're missing is:

.. versionadded:: 2.1
    The ability to reference local variables in the template (e.g. ``message``) was added in TwigComponents 2.1.
    Previously, all data needed to be referenced through ``this`` (e.g. ``this.message``).

That would hopefully give a hint of a feature doesn't work.

@allejo
Copy link
Contributor Author

allejo commented Jan 24, 2022

Ah that would explain things! Thanks for the clarification! I'll close this PR in favor of #244 then 👍

@allejo allejo closed this Jan 24, 2022
@allejo allejo deleted the patch-1 branch January 24, 2022 18:17
weaverryan added a commit that referenced this pull request Jan 25, 2022
…public props (kbond)

This PR was merged into the 2.x branch.

Discussion
----------

[TwigComponent][LiveComponent] clarify excluding this for public props

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| Tickets       | Fix #242
| License       | MIT

Commits
-------

69207a0 [TwigComponent][LiveComponent] clarify excluding this for public props
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.

2 participants