Every line of 'react hook before render' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
78 function unmountHook() { 79 act(() => { 80 removeCleanup(unmountHook) 81 unmount() 82 }) 83 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
18 render() { 19 const prevContext = context 20 try { 21 context = this 22 this.cursor = 0 23 return this.fn(this.props) 24 } finally { 25 context = prevContext 26 } 27 }
32 export function useUnmount(component: Component, hook: (token: UnmountToken) => void): void { 33 /* istanbul ignore else */ 34 if (process.env.IVI_TARGET !== "ssr") { 35 const hooks = component.s; 36 hooks.u = addHook(hooks.u, hook); 37 } 38 }
34 render() { 35 if (this.isConnected) { 36 this.currentElement = render(h(preactComponent, this.getProps()), this, this.currentElement) 37 } 38 }
36 renderReact() { 37 ReactDOM.render( 38 React.createElement(this.reactClass, this._props), 39 this.ref.nativeElement); 40 }
34 hook = function hook(context) { 35 context = context || 36 this.$vnode && this.$vnode.ssrContext || 37 this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; 38 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { 39 context = __VUE_SSR_CONTEXT__; 40 } 41 if (style) { 42 style.call(this, createInjectorSSR(context)); 43 } 44 if (context && context._registeredComponents) { 45 context._registeredComponents.add(moduleIdentifier); 46 } 47 };
31 afterComponentDidUpdate(cb: () => void): void { 32 this._afterComponentDidUpdateQueue.push(cb); 33 }
20 componentWillMount() { 21 const { routes } = this.props; 22 const { store, router } = this.context; 23 this.unListenBefore = router.listenBefore( 24 createTransitionHook(store, routes), 25 ); 26 }
42 render() { 43 const { generateTestHook, foo } = this.props; 44 return ( 45 <View ref={generateTestHook('View')}> 46 <WrappedFunctionComponent 47 ref={generateTestHook('WrappedFunctionComponent')} 48 text='text' 49 /> 50 51 <WrappedText ref={generateTestHook('WrappedText')}> 52 Wrapped text 53 </WrappedText> 54 55 <Text>{foo}</Text> 56 57 <TextInput ref={generateTestHook('Input', this.setTextInputRef)} /> 58 </View> 59 ); 60 }
70 export function devModeOnElementBeforeCreate(vnode: VNode<any>): void { 71 if (__IVI_DEV__) { 72 if (DEV_HOOKS.onElementBeforeCreate) { 73 for (const hook of DEV_HOOKS.onElementBeforeCreate) { 74 hook(vnode); 75 } 76 } 77 } 78 }