Skip to content

Commit 420319d

Browse files
committed
fix: nerv-server support hooks
1 parent 11c797e commit 420319d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/nerv-server/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
isComposite
88
} from 'nerv-shared'
99
import { isString, isNumber, isFunction, isArray, clone, extend } from 'nerv-utils'
10-
import { Component } from 'nervjs'
10+
import { Component, renderComponent } from 'nervjs'
1111
import {
1212
encodeEntities,
1313
isVoidElements,
@@ -152,7 +152,7 @@ function renderVNodeToString (vnode, parent, context, isSvg?: boolean) {
152152
instance.componentWillMount()
153153
instance.state = instance.getState()
154154
}
155-
const rendered = instance.render()
155+
const rendered = renderComponent(instance)
156156
if (isFunction(instance.getChildContext)) {
157157
context = extend(clone(context), instance.getChildContext())
158158
}

packages/nerv/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { useEffect, useLayoutEffect, useReducer, useState, useRef, useCallback,
2323
import { createRef, forwardRef } from './create-ref'
2424
import { memo } from './memo'
2525
import { createContext } from './create-context'
26+
import { renderComponent } from './lifecycle'
2627

2728
export {
2829
Children,
@@ -47,6 +48,7 @@ export {
4748
forwardRef,
4849
memo,
4950
createContext,
51+
renderComponent,
5052
useEffect, useLayoutEffect, useReducer, useState, useRef, useCallback, useMemo, useImperativeHandle, useContext
5153
}
5254

@@ -73,5 +75,6 @@ export default {
7375
forwardRef,
7476
memo,
7577
createContext,
78+
renderComponent,
7679
useEffect, useLayoutEffect, useReducer, useState, useRef, useCallback, useMemo, useImperativeHandle, useContext
7780
}

0 commit comments

Comments
 (0)