36 |
37 |
38 |
39 | todos
40 |
41 |
47 |
48 |
49 | {hasTodos &&
50 |
54 | }
55 |
56 |
69 |
70 | );
71 | }
72 | }
73 |
74 | export default createFragmentContainer(TodoApp, {
75 | viewer: graphql`
76 | fragment TodoApp_viewer on User {
77 | id,
78 | totalCount,
79 | ...TodoListFooter_viewer,
80 | ...TodoList_viewer,
81 | }
82 | `,
83 | });
84 |
--------------------------------------------------------------------------------
/src/GraphQL.Relay.Todo/ClientApp/components/TodoList.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This file provided by Facebook is for non-commercial testing and evaluation
3 | * purposes only. Facebook reserves all rights not expressly granted.
4 | *
5 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
8 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
9 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
10 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 | */
12 |
13 | import MarkAllTodosMutation from '../mutations/MarkAllTodosMutation'
14 | import Todo from './Todo'
15 |
16 | import React from 'react'
17 | import { createFragmentContainer, graphql } from 'react-relay'
18 |
19 | class TodoList extends React.Component {
20 | _handleMarkAllChange = e => {
21 | const complete = e.target.checked
22 | MarkAllTodosMutation.commit(
23 | this.props.relay.environment,
24 | complete,
25 | this.props.viewer.todos,
26 | this.props.viewer
27 | )
28 | }
29 |
30 | renderTodos() {
31 | return this.props.viewer.todos.edges.map(edge => (
32 |