Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Clarifying Creating Reagent Components for Subscriptions #433

Closed
whamtet opened this issue Dec 4, 2017 · 2 comments
Closed

Clarifying Creating Reagent Components for Subscriptions #433

whamtet opened this issue Dec 4, 2017 · 2 comments

Comments

@whamtet
Copy link

whamtet commented Dec 4, 2017

Thanks for the great page on Creating Reagent Components

One issue that I'm not clear on is whether a second order function is necessary when dereferencing a subscription. For example

(defn my-component []
  (let [my-val (subscribe [:my-sub])]
    [:div @my-val]))

(defn my-component-second-order []
  (let [my-val (subscribe [:my-sub])]
    (fn []
      [:div @my-val])))

I'm guessing the first form is ok because the atom is not actually created in the let block, but it would be good to clarify in the doco. I'm happy to do a doco PR if you'd like.

@whamtet whamtet changed the title Clarifying Creating Reagent Components for Subscriptions #docs Clarifying Creating Reagent Components for Subscriptions Dec 4, 2017
@danielcompton
Copy link
Contributor

danielcompton commented Dec 4, 2017

Hi @whamtet form-1 reagent components are fine now for using re-frame subscriptions, #218 and https://lambdaisland.com/blog/11-02-2017-re-frame-form-1-subscriptions have more details on this. I thought we had some docs on this somewhere, but I had a quick look and couldn't come up with anything. Happy to take a PR on this, but I'm not really sure where it should go. @mike-thompson-day8 is more clued up with the docs, but he's unavailable for the next few weeks. So, happy to take a PR but it might be a while before it gets reviewed and merged.

@mike-thompson-day8
Copy link
Contributor

I'm closing this. I think most of the re-frame docs and examples clear.

@day8 day8 locked and limited conversation to collaborators Mar 29, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants