loading...

Discussion on: React: "I really wish this is how I could write components."

Collapse
patroza profile image
Patrick Roza

I think it would be nice to have a refetch action so that the request can be remade even to the same url.
Also I think it would be nice to be able to distinguish then between the initial fetch, and future updates.

Also im debating with myself if I like the separate callbacks for each case, or if I would prefer being given the loading, data and error props together, and then do a more imperative approach with conditions. It seems more flexible.
In that case I would make the render function separately available, instead of wrapping it around the data

Something along the lines of the react-apollo graphql HOC and Query component etc, but then for REST.

Collapse
joelnet profile image
JavaScript Joel Author

All great features! Submit a pull request ;)

Collapse
patroza profile image
Patrick Roza

Would love to, but where to? Where the codes at? :)
(Maybe im blind)

Thread Thread
joelnet profile image
JavaScript Joel Author

There's no repo for it. It was just a live stream demo :)

Collapse
patroza profile image
Patrick Roza

Anyway, here it is; written in the train, so apologies for any typos ;-)

gist.github.com/patroza/4488f8fa2b...