Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

transformContext.js 413B

12345678910111213
  1. import React from 'react';
  2. import forwardRef from './forwardRef';
  3. export default function transformContext(Context) {
  4. return forwardRef(function (props) {
  5. return React.createElement(Context.Consumer, null, function (context) {
  6. return React.createElement(Context.Provider, {
  7. value: props.mapToValue(context)
  8. }, props.children);
  9. });
  10. }, {
  11. displayName: 'ContextTransformer'
  12. });
  13. }