Cell Reusability

How do we use Redwood Created Cells without having to render them with tags for example they already contain queries etc.

Hey there!

Could you share some code of what you’re trying to do?

I have one cell named WorkflowCell, has query and nifty functions which returns a json of Workflow using graphql query. Now I have another cell called workload where i am need to use some of the nifty functions in the first cell how do I use them?

Aaah, I see, Cell’s can only “render.”

I’m guessing you want to grab the data from the first cell and then use that in the second?

That is correct. But having a tough time doing it.

What if your cell is a composite of two rendered controls?

The single query returns data needed by both?

query COMPOSITE_CELL {
  cell1data { name }
  cell2data { title }
}

Your Cell could use two other rendered components (that are shared between the single cell and the multi one)?

And that “composite cell” would have those functions that can be shared by the two components.

Cells do not necessary have to map to a single Model.

See that is my question how do i call those functions, without having to you know whatever?

Anything in a Cell’s QUERY is automatically posted to the API. The results of that query are available in Success:

export const Success = (props) => {
    console.log(props)
}