Fork me on GitHub

I'm having a hard time understanding when to use params and when to use props. Particularly: I've got a "details view" component which displays the details for (basically) a row in a database. Should this component have a param for the ID of the row it is displaying, and I use set-query to update the param whenever I want to display a different row? Or should the parent component take responsibility for managing which ID to query for, and merely instantiate the details view with the props after the query comes back with data?


Related. It seems like any functionality provided by IQueryParams can instead be accomplished by props.

(query [this] (let [pseudo-param (if (om/component? this) (-> this om/props :pseudo-param) "default value")] ...))


So I'm unclear on whether I should be updating the state atom in order to trigger the appropriate query updates, or whether I should be updating the query params in order to trigger the appropriate query updates.


query param seems like the most appropriate answer


basically the queries are managed in a parent component in the background, that's how relay works, the params are just the props from the wrapper component that sends the state to the child details view, using state and props just duplicates the idea


what happens behind the query update is a update in the wrapper components state that triggers the request


Trying to decide now on whether to represent a query as [([:foo/by-id id] {:limit 10 :etc :etc})] or as [(:foo/detail {:id id :limit 10 :etc :etc})]


I'm not really sure which is a more "canonical" query for the server to interpret.