Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Замыкание в functional component
Замыкание в functional component
function CustomForm ({handleSubmit}) {
let inputElement
return (
<form onSubmit={() => handleSubmit(inputElement.value)}>
ref={(input) => inputElement = input} />
<button type='submit'>Submit</button>
<Twitter username='tylermcginnis33'>
{(user) => user === null
? <Loading />
: <Badge info={user} />}
import React, { Component, PropTypes } from 'react'
import fetchUser from 'twitter'
// fetchUser принимает имя пользователя и возвращает promise
// который резолвится с данными пользователя
class Twitter extends Component {
// закончите код здесь
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.