Advertisement
Guest User

Untitled

a guest
Mar 6th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as React from 'react';
  2. import { withContext, getContext, mapProps, compose } from 'recompose';
  3. import * as PropTypes from 'prop-types';
  4. import { Requireable } from 'prop-types';
  5.  
  6. const provideValue = withContext<{}, { value: string }>(
  7.   {
  8.     value: PropTypes.string
  9.   },
  10.   ({ value }) => ({ value })
  11. );
  12.  
  13. const Wrapper: React.SFC<{ value: string }> = ({ children }) => <>{children}</>;
  14.  
  15. export const ValueProvider = provideValue(Wrapper);
  16.  
  17. export const connectValue = compose<{ value: string }, {}>(getContext({ value: PropTypes.string }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement