Skip to content
This repository was archived by the owner on Aug 3, 2023. It is now read-only.
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

Add FAQ #19

@jamesplease

Description

@jamesplease

Some questions:

Why would you use JSX for making HTTP requests?

It may seem weird, but it turns out that many of the complex things people do with HTTP requests map nicely to the component lifecycle. You can remove a lot of code from your application by declaratively specifying how you want your requests to behave through JSX.

Still not convinced? Check out some of the examples.

What if I just want a regular fetch component, without the deduplication and other features?

Use holen.

What about normalization of data? Apollo does this.

That requires a definition of what a resource is, which is a little bit opinionated for this library. Another library, Redux Resource, defines a generic notion of a resource. Pretty soon we will have official bindings from React Request to Redux Resource.

Why isn't this a higher-order component like Apollo's graphql?

The render prop pattern is more powerful than Higher Order Components. Read this post for more.

Why is the prop named render rather than children?

There are some good arguments for the render prop to be render rather than children, but ultimately, this library will likely use whatever pattern the new Context API uses.

Why is there a compose component, when that doesn't exist in Apollo?

Apollo has the benefit of assuming a GraphQL API, which allows you to easily concatenate multiple queries into a single, larger query. Typical APIs are resource-based, which means it sometimes takes more than one request to get all of the information you need for the page.

How do you put the response on context?

You must do it manually now, but in the future we may add a prop to do this for you, once the new Context API is finalized and released.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions