What identifies a Cell as a Cell?

Cells have the same extension as JS. Is the babel extension looking at the file name to check if it’s a Cell?

A “cell” is just a React component. So there’s no need for any special handling.

But the concept is unique. Here’s a recent write-up with more details:

1 Like

Sure, I get that it’s a React component. But something is actually doing the GQL work, and figuring out to call Success or Loading, etc. So how does whatever that thing is know to do that, is it by looking at the filename during babel transpilation?

Ah, understood! What you’re not seeing is our behind-the-scenes auto-importing and wrapper.

Here’s where Redwood handles the GraphQL for cells in our web/ package:

And here’s where we set Webpack config for auto-importing:

Note: graphql import is effectively import gql from 'graphql-tag'

Ok, so basically, all the JS files are potential cells if they use gql. Not a criticism, just trying to figure this out.

Correct – meaning it’s not about specifying file type or directory name. If a component has gql, it will be executed and the query lifecycle will be managed. “Cell” as a concept involves more than that, but it seems you’re clear on that aspect, correct?

And no criticism inferred! Appreciate you taking the time to dig in and ask.

I think it’s a great concept. Thanks for answering my questions.

1 Like