"I can't pass opts directly into the view."

Sure you can - om/build can be given opts, but perhaps I'm misunderstanding
your intent. Some sample code would help.

"Om needs components to nest in each other, not in app state. (Though I
don't see why this *could not* work *somehow*, it does seem to be sketchy."

It can work by storing the component function in app-state (rather than
it's return value) and then calling build in render. I do this for genetic
components.
You can't store the react component directly for multiple reasons:
1. If you did you would break the lifecycle functions because it has no way
of determining if a component is mounted or not (because being rendered or
not being rendered triggers this now. You could theoretically make this
work of course)
2. You could then (accidentally?) render a component multiple times, again
messing with the lifecycle and breaking rendering optimizations
3. Components are strictly in a hierarchy, this allows Om to optimise
rendering
4. Internally Om tracks a components parent. Creating a component outside
of render breaks this

Ultimately I believe it's a react restriction, although not one that I've
ever found limiting in my own rather large and complex Om app.

On Tue, 9 Dec 2014 05:06 David James <[email protected]> wrote:

> David Mohl: I agree with Daniel's response. At first, you were trying to
> keep a component directly in the application state. This strikes me as odd
> and probably a bad idea. I say this for three reasons:
>
> 1. Intuition (not a persuasive argument, I admit)
> 2. Om needs components to nest in each other, not in app state. (Though I
> don't see why this *could not* work *somehow*, it does seem to be sketchy.
> 3. It is better to keep your app-state as small as possible. Why store a
> generated component when all you need to do is store a path or route?
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to