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

Confusing syntax with wrap and args destructuring #110

Closed
lilactown opened this issue Oct 3, 2022 · 1 comment
Closed

Confusing syntax with wrap and args destructuring #110

lilactown opened this issue Oct 3, 2022 · 1 comment

Comments

@lilactown
Copy link
Owner

Ran into this in a PR last week, where someone had originally done

(defnc my-component
  [{:keys [foo bar]}]
  {:wrap (with-baz #(str foo bar))}
  ,,,)

Which syntactically looks right, but actually foo bar aren't destructured until after with-baz is called to wrap the component. The author corrected their code, but I was confused why they changed it!

Perhaps we should move the :wrap metadata above the args so that it's clearer what's in scope?

(defnc my-component
  {:wrap (with-baz #(str (:foo %) (:bar %))}
  [{:keys [foo bar]}]
  ,,,)
@dvingo
Copy link

dvingo commented Nov 11, 2022

👍🏾 This is also aligned with metadata forms on defn

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

No branches or pull requests

2 participants