We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider the following code:
import * as React from 'react'; import { adopt, Mapper, MapProps } from 'react-adopt'; import { Mutation, Query } from 'react-apollo'; import { MY_QUERY, MY_MUTATION } from 'graphql/queries'; interface AdoptRenderProps { myQuery: string; myMutation: () => void; } interface AdoptProps { render?: any; } export default class Search extends React.Component< {}, { token: string; } > { state = { token: '', }; public render(): JSX.Element { const mapper: Mapper<AdoptRenderProps, AdoptProps> = { myQuery: ({ render }) => <Query query={MY_QUERY}>{render}</Query>, myMutation: ({ render }) => ( <Mutation mutation={MY_MUTATION}> {(mutation, result) => render({ mutation, result })} </Mutation> ), }; const mapProps: MapProps<AdoptRenderProps> = ({ myQuery, myMutation, }) => ({ myQuery: myQuery.data, myMutation: myMutation.mutation, }); const Composed = adopt(mapper, mapProps); return ( <Composed> {({ myQuery, myMutation }) => { const { token } = this.state; return ( <form> <input type="text" value={token} onChange={this.handleInputChange} /> </form> ); }} </Composed> ); } private handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { this.setState({ token: e.target.value, }); }; }
Input field focus in lost immediately after I type a letter.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Consider the following code:
Input field focus in lost immediately after I type a letter.
The text was updated successfully, but these errors were encountered: