News for hackers. Stuff that matters.
Re:Ask HN: What tech that's right around the corner are you ... by arstin on Friday August 04, 2017 @02:46PM (#14930943)
This frontend code.

  const ProfileImage = ({ user }) => <img src={user.avatarUrl} alt={user.name} />;
  
  const query = gql`{
    user(id: 3) {
      name
      avatarUrl
    }
  }`

  export const ProfileImageWithData = graphql(query)(ProfileImage);
You can ask for data in the structure the UI expects and only get exactly that data, letting the GQL client handle batching network requests for needs distributed across the whole app, caching, UI updating, etc under the hood. Also does a great job of decoupling product and data management code.

There are no comments on this comment yet.