chore: remove unnecessary hooks api
This commit is contained in:
parent
8602b61efb
commit
774cce324d
@ -1,6 +1,5 @@
|
|||||||
import { ComponentInstance, FunctionalComponent, Component } from '../component'
|
import { ComponentInstance } from '../component'
|
||||||
import { mergeLifecycleHooks, Data, WatchOptions } from '../componentOptions'
|
import { mergeLifecycleHooks, WatchOptions } from '../componentOptions'
|
||||||
import { VNode, Slots } from '../vdom'
|
|
||||||
import { observable, computed } from '@vue/observer'
|
import { observable, computed } from '@vue/observer'
|
||||||
import { setupWatcher } from '../componentWatch'
|
import { setupWatcher } from '../componentWatch'
|
||||||
|
|
||||||
@ -200,15 +199,3 @@ export function useComputed<T>(getter: () => T): T {
|
|||||||
}
|
}
|
||||||
return handles[id]()
|
return handles[id]()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function withHooks(render: FunctionalComponent): new () => Component {
|
|
||||||
return class ComponentWithHooks extends Component {
|
|
||||||
static displayName = render.name
|
|
||||||
render(props: Data, slots: Slots, attrs: Data, parentVNode: VNode) {
|
|
||||||
setCurrentInstance((this as any)._self)
|
|
||||||
const ret = render(props, slots, attrs, parentVNode)
|
|
||||||
unsetCurrentInstance()
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -22,7 +22,6 @@ export { memoize } from './optional/memoize'
|
|||||||
|
|
||||||
// Experimental APIs
|
// Experimental APIs
|
||||||
export {
|
export {
|
||||||
withHooks,
|
|
||||||
useState,
|
useState,
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
|
Loading…
Reference in New Issue
Block a user