How to use the react-relay.createContainer function in react-relay

To help you get started, we’ve selected a few react-relay examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tubackkhoa / tkframework / client / ui / backend / containers / Post / Form / edit.jsx View on Github external
}
    })
  }

  render(){    
    const post = copyFromRelay(this.props.node)    
    return (
      this.postForm=com}  initialValues={post} />
    )
  }

}

// should not share fragment between component !!!
export default Relay.createContainer(PostFormEdit, { 
  fragments: {

    node: () => Relay.QL `
      fragment OnePost on Post {
        id
        title
        lead_sentence
        published_at
        tags {
          id
          name
        }
        items {
          id
          target_type
          sort_rank
github guymers / babel-plugin-flow-relay-query / test / fixture / fragment / relay_createcontainer_hoc / source.js View on Github external
const RelayHOC = (component, options) => Relay.createContainer(component, options);
github guymers / babel-plugin-flow-relay-query / test / fixture / fragment / extends_component / source.js View on Github external
class Article extends Component {
  props: ArticleProps;

  render() {
    const { article } = this.props;
    return (
      <div>
        <div>{article.title} ({article.posted})</div>
        <div>{article.author.name} [{article.author.email}]</div>
        <div>{article.content}</div>
      </div>
    );
  }
}

export default Relay.createContainer(Article, {
  fragments: {
    article: generateFragmentFromProps()
  }
});
github mattias800 / react-native-relay-facebook-neo4j-starter-kit / app / src / use-case / users / user-list / UserListPage.js View on Github external
hasNextPage
                    }
                    edges {
                        node {
                            id
                            ${UserListItem.getFragment('user')}
                        }
                    }
                }
            }
    `,
    },
});

export const UserListPageComponent = createRelayRenderer(
    Relay.createContainer(
        props =&gt; ,
        {
            fragments: {
                viewer: () =&gt; Relay.QL`
                    fragment on Viewer {
                        ${UserListPage.getFragment('viewer')}
                    }
        `,
            },
        }),

    props =&gt; ({
        queries: {
            viewer: (Component) =&gt;
                Relay.QL`
github Pathgather / smashgather / server / js / components / User.js View on Github external
var name = "unknown"
      var portraitUrl = "img/unknown.png"
    }
    return (
      <div style="{{">
        <div>{ mainCharacter }{ winStats }{ victory }</div>
      </div>
    )
  }
}

export let User = Relay.createContainer(UserComponent, {
  fragments: {
    user: () =&gt; Relay.QL`
      fragment on User {
        name
        wins
        weeklyWins
        character {
          ${Character.getFragment("character")}
        }
      }
    `,
  },
})
github alloy / relational-theory / app / containers / pure-react / artist / artwork.tsx View on Github external
interface State {
}

export class Artwork extends React.Component {
  render() {
    return (
      <div>
        <img src="{this.props.artwork.image.url}">
        <h3>{this.props.artwork.artists.map((artist) =&gt; artist.name).join(", ")}</h3>
        <h4>{this.props.artwork.title}</h4>
      </div>
    )
  }
}

export default Relay.createContainer(Artwork, {
  fragments: {
    artwork: () =&gt; Relay.QL`
      fragment on Artwork {
        title
        artists {
          name
        }
        image {
          url
        }
      }
    `,
  },
})
github doabit / react-relay-graphql-starter-kit / js / components / people / PersonList.js View on Github external
<li>
                {edge.node.firstName}
             </li>
          )}
        
        <button style="{buttonStyle}"> this.props.relay.setVariables({limit: currentNumber + 5})}&gt;
            load more
        </button>
      
    );
  }
}

export default Relay.createContainer(PersonList, {
  initialVariables: {
    limit: 5
  },
  fragments: {
    store: () =&gt; Relay.QL`
      fragment on Store {
        people(first: $limit){
          edges{
            node{
              id
              firstName
              lastName
              email
            }
          },
          pageInfo {
github gauravtiwari / relay-rails-blog / app / assets / javascripts / components / post.es6.js View on Github external
});
          }
        }
      }
    }.bind(this));
  }
}

module.exports = Post;

/*
  Relay Container: Post
  Defines data need for this post
*/

var PostContainer = Relay.createContainer(Post, {
    initialVariables: {
      count: 20,
      order: "-id"
    },
    fragments: {
        post: () => Relay.QL`
          fragment on Post {
            id,
            title,
            slug,
            body,
            voted,
            created_at,
            comments_count,
            votes_count,
            user {