|
1 | 1 | "use strict"; |
2 | 2 |
|
3 | | -const React = require("react"); |
| 3 | +import React from "react"; |
4 | 4 | const createElement = React.createElement; |
5 | 5 | const Fragment = React.Fragment; |
6 | 6 |
|
7 | | -exports.empty = null; |
8 | | - |
9 | | -exports.keyed = (key) => (child) => |
10 | | - createElement(Fragment, { key: key }, child); |
11 | | - |
12 | | -exports.element = (component) => (props) => |
13 | | - Array.isArray(props.children) |
14 | | - ? createElement.apply(null, [component, props].concat(props.children)) |
15 | | - : createElement(component, props); |
16 | | - |
17 | | -exports.elementKeyed = (component) => (props) => |
18 | | - createElement(component, props); |
19 | | - |
20 | | -exports.fragment = (children) => |
21 | | - createElement.apply(null, [Fragment, null].concat(children)); |
22 | | - |
23 | | -exports.createContext = (defaultValue) => () => |
24 | | - React.createContext(defaultValue); |
25 | | - |
26 | | -exports.contextProvider = (context) => context.Provider; |
27 | | - |
28 | | -exports.contextConsumer = (context) => context.Consumer; |
| 7 | +export var empty = null; |
| 8 | + |
| 9 | +export function keyed(key) { |
| 10 | + return (child) => |
| 11 | + createElement(Fragment, { key: key }, child); |
| 12 | +} |
| 13 | + |
| 14 | +export function element(component) { |
| 15 | + return (props) => |
| 16 | + Array.isArray(props.children) |
| 17 | + ? createElement.apply(null, [component, props].concat(props.children)) |
| 18 | + : createElement(component, props); |
| 19 | +} |
| 20 | + |
| 21 | +export function elementKeyed(component) { |
| 22 | + return (props) => |
| 23 | + createElement(component, props); |
| 24 | +} |
| 25 | + |
| 26 | +export function fragment(children) { |
| 27 | + return createElement.apply(null, [Fragment, null].concat(children)); |
| 28 | +} |
| 29 | + |
| 30 | +export function createContext(defaultValue) { |
| 31 | + return () => |
| 32 | + React.createContext(defaultValue); |
| 33 | +} |
| 34 | + |
| 35 | +export function contextProvider(context) { |
| 36 | + return context.Provider; |
| 37 | +} |
| 38 | + |
| 39 | +export function contextConsumer(context) { |
| 40 | + return context.Consumer; |
| 41 | +} |
0 commit comments