jedifocus.hocs
Version:
Higher order components for JediFocus.
47 lines (40 loc) • 965 B
Flow
/* __.-._
* '-._"7' JediFocus
* /'.-c
* | /T Do. Or do not.
* _)_/LI There is no try.
*
* This project is a part of the “Byte-Sized JavaScript” videocasts.
* You can watch “Byte-Sized JavaScript” at: https://bytesized.tv/
*
* MIT Licensed — See LICENSE.md
*
* Send your comments, suggestions, and feedback to me@volkan.io
*/
// @flow
import type {
AppConfig,
ReactNodeFactory,
ReactNode
} from 'jedifocus-hocs-types';
import React from 'react';
const connectedAppContainer = (
ContainerComponent: ReactNode,
config: AppConfig
): ReactNodeFactory => {
const email = config.email;
const fbUserId = config.fbUserId;
const password = config.password;
delete config.email;
delete config.password;
delete config.fbUserId;
return () => (
<ContainerComponent
config={config}
email={email}
password={password}
userId={fbUserId}
/>
);
};
export { connectedAppContainer };