In the TodoInput component, there's a text input that allows the user to enter new todo items. When they're done entering the todo, Relay will need to send a mutation to the backend GraphQL server. Here's what the component code looks like:
import React, { Component } from 'react';
import { TextInput } from 'react-native';
import styles from './styles';
import AddTodoMutation from './mutations/AddTodoMutation';
export default class App extends Component {
onSubmitEditing = ({ nativeEvent: { text } }) => {
const { environment, viewer } = this.props;
AddTodoMutation.commit(environment, viewer, text);
};
render() {
return (
<TextInput
style={styles.textInput}
placeholder="What needs to be done?"
onSubmitEditing={this.onSubmitEditing}
/>
);
}
}
It doesn't look that different from your typical React Native component. The piece that stands out is the mutation—AddTodoMutation. This is how you tell the GraphQL backend that you want a new todo node created.
Let's see what the application looks like so far:

The textbox for adding new todo items is just above the list of todo items. Now, let's look at the TodoList component, which is responsible for rendering the todo item list.