Permalink
Browse files
fix: createFactory support
- Loading branch information...
Showing
with
16 additions
and
3 deletions.
-
+1
−0
README.md
-
+4
−0
packages/nerv/src/dom.ts
-
+11
−3
packages/nerv/src/index.ts
|
@@ -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`
|
|
|
|
@@ -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
|
|
|
|
@@ -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