Matt Krick
1 min readDec 12, 2017

--

Oh man, that’s a difficult one that’s definitely client cache dependent. Since Relay’s compiler makes full use of babel, having a fragment that’s built at runtime is difficult. I can say that whenever I feel the urge to copy/paste a fragment, it means I haven’t colocated my data down to the correct child component or it’s even a smell that I need an intermediary component. This often happens when I have to sort/filter the result from Relay & stick that in the component state. So with that said, I keep a mutations folder, a subscriptions folder, and a helpers folder (with functions to modify the ProxyStore & optimistic UI). For every component that uses the QueryRenderer, I suffix the filename with “Root” for easy search (eg TeamRoot renders Team).That’s it!

--

--

Matt Krick
Matt Krick

Responses (1)