What are the life cycle methods of React Native Component? A component's life cycle in React Native can be divided into 4 phases: React Native Component life cycle phases Mounting: In this phase, component instance is created and inserted into the DOM. Updating: In updating phase, a react component is said to be born and it start growing by receiving new updates. Unmounting: In this phase, a react component gets removed from actual DOM. Error Handling: It is called when any error occurs while rendering the component. Now let's discuss about different methods that gets called during these phases. Mounting phase Below are the methods which gets called when instance of component is created and inserted into the DOM. Constructor() static getDerivedStateFromProps() render() ComponentDidMount() Constructor() constructor ( props ) { super ( props ) ; this . state = { employeeId : 0 } ; } It is first method which gets called in the ...
Learn how to create iOS apps with Swift and React Native using our free programming tutorials and get a dose of latest technology news and tech products.
Comments
Post a Comment