| 103 | } |
| 104 | |
| 105 | export function pushStartInstance( |
| 106 | target: Array<Chunk | PrecomputedChunk>, |
| 107 | type: string, |
| 108 | props: Object, |
| 109 | resumableState: ResumableState, |
| 110 | renderState: RenderState, |
| 111 | preambleState: null | PreambleState, |
| 112 | hoistableState: null | HoistableState, |
| 113 | formatContext: FormatContext, |
| 114 | textEmbedded: boolean, |
| 115 | ): ReactNodeList { |
| 116 | for (const propKey in props) { |
| 117 | if (hasOwnProperty.call(props, propKey)) { |
| 118 | const propValue = props[propKey]; |
| 119 | if (propKey === 'ref' && propValue != null) { |
| 120 | throw new Error( |
| 121 | 'Cannot pass ref in renderToHTML because they will never be hydrated.', |
| 122 | ); |
| 123 | } |
| 124 | if (typeof propValue === 'function') { |
| 125 | throw new Error( |
| 126 | 'Cannot pass event handlers (' + |
| 127 | propKey + |
| 128 | ') in renderToHTML because ' + |
| 129 | 'the HTML will never be hydrated so they can never get called.', |
| 130 | ); |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | return pushStartInstanceImpl( |
| 136 | target, |
| 137 | type, |
| 138 | props, |
| 139 | resumableState, |
| 140 | renderState, |
| 141 | preambleState, |
| 142 | hoistableState, |
| 143 | formatContext, |
| 144 | textEmbedded, |
| 145 | ); |
| 146 | } |
| 147 | |
| 148 | export function pushTextInstance( |
| 149 | target: Array<Chunk | PrecomputedChunk>, |