Permalink
Browse files

fix: createFactory support

  • Loading branch information...
1 parent 366c210 commit eafb923c2f0cf56705175b68bc703497369f29bd @yuche yuche committed Jan 15, 2018
Showing with 16 additions and 3 deletions.
  1. +1 −0 README.md
  2. +4 −0 packages/nerv/src/dom.ts
  3. +11 −3 packages/nerv/src/index.ts
View
@@ -197,6 +197,7 @@ Nerv currently support React API and features:
* React.PropTypes
* React.Children
* React.isValidElement
+* React.createFactory
* [Error Boundaries](https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries) (React 16)
### `react-dom`
View
@@ -18,6 +18,10 @@ export function findDOMNode (component) {
return component && component.dom
}
+export function createFactory (type) {
+ return createElement.bind(null, type)
+}
+
class WrapperComponent<P, S> extends Component<P, S> {
getChildContext () {
// tslint:disable-next-line
View
@@ -8,7 +8,13 @@ import { isValidElement } from 'nerv-shared'
import { Children } from './children'
import { hydrate } from './hydrate'
import options from './options'
-import { unmountComponentAtNode, findDOMNode, createPortal, unstable_renderSubtreeIntoContainer } from './dom'
+import {
+ unmountComponentAtNode,
+ findDOMNode,
+ createPortal,
+ unstable_renderSubtreeIntoContainer,
+ createFactory
+} from './dom'
export {
Children,
@@ -24,7 +30,8 @@ export {
unmountComponentAtNode,
createPortal,
unstable_renderSubtreeIntoContainer,
- hydrate
+ hydrate,
+ createFactory
}
export default {
@@ -41,5 +48,6 @@ export default {
unmountComponentAtNode,
createPortal,
unstable_renderSubtreeIntoContainer,
- hydrate
+ hydrate,
+ createFactory
} as any

0 comments on commit eafb923

Please sign in to comment.