/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
client/components/user/docs/example.jsx
23 строки
594 B
Marko Andrijasevic
React: add new JSX transform (#56451)
29 сен 2021, 13:49
Не верифицирован
29 сен 2021, 13:49
f2e6f88
Код
Авторство
О чём код?
import { connect } from 'react-redux'; import { getCurrentUser } from 'calypso/state/current-user/selectors'; import UserItem from '../index'; const UserItemExample = ( { currentUser } ) => { return <UserItem user={ currentUser } />; }; const ConnectedUserItemExample = connect( ( state ) => { const user = getCurrentUser( state ); if ( ! user ) { return {}; } const currentUser = Object.assign( {}, user, { name: user.display_name } ); return { currentUser, }; } )( UserItemExample ); ConnectedUserItemExample.displayName = 'UserItem'; export default ConnectedUserItemExample;