Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
})
}
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
const RelayHOC = (component, options) => Relay.createContainer(component, options);
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()
}
});
hasNextPage
}
edges {
node {
id
${UserListItem.getFragment('user')}
}
}
}
}
`,
},
});
export const UserListPageComponent = createRelayRenderer(
Relay.createContainer(
props => ,
{
fragments: {
viewer: () => Relay.QL`
fragment on Viewer {
${UserListPage.getFragment('viewer')}
}
`,
},
}),
props => ({
queries: {
viewer: (Component) =>
Relay.QL`
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: () => Relay.QL`
fragment on User {
name
wins
weeklyWins
character {
${Character.getFragment("character")}
}
}
`,
},
})
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) => artist.name).join(", ")}</h3>
<h4>{this.props.artwork.title}</h4>
</div>
)
}
}
export default Relay.createContainer(Artwork, {
fragments: {
artwork: () => Relay.QL`
fragment on Artwork {
title
artists {
name
}
image {
url
}
}
`,
},
})
<li>
{edge.node.firstName}
</li>
)}
<button style="{buttonStyle}"> this.props.relay.setVariables({limit: currentNumber + 5})}>
load more
</button>
);
}
}
export default Relay.createContainer(PersonList, {
initialVariables: {
limit: 5
},
fragments: {
store: () => Relay.QL`
fragment on Store {
people(first: $limit){
edges{
node{
id
firstName
lastName
email
}
},
pageInfo {
});
}
}
}
}.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 {