Basic Introduction of React or ReactJS: It is an open source Javascript library created by Facebook for better UI development and Efficient DOM manipulation. React have a virtual DOM concept. When any data is received from the server then this virtual DOM has modified accordingly then this updated virtual DOM is matched with Real DOM by some algorithm and only those portion of Real DOM is updated which is different from Virtual Dom.
ReactJS
- React is used for creating websites, web apps, SPAs etc.
- React is a Javascript library used for creating UI hierarchy.
- It is responsible for rendering of UI components, It is considered as V part Of MVC framework.
- React’s virtual DOM is faster than the conventional full refresh model, since the virtual DOM refreshes only parts of the page, Thus decreasing the page refresh time.
- React uses components as basic unit of UI which can be reused this saves coding time.
- Simple and easy to learn.
React sample code
import React, { Component } from 'react' ;
import ReactDOM from 'react-dom' ;
class Clock extends React.Component {
constructor(props) {
super (props);
this .state = {date: new Date()};
}
componentDidMount() {
this .timerID = setInterval(
() => this .tick(),
1000
);
}
componentWillUnmount() {
clearInterval( this .timerID);
}
tick() {
this .setState({
date: new Date()
});
}
render() {
return (
<div>
<h1>Today Date and Time</h1>
<h2>It is { this .state.date.toLocaleTimeString()}.</h2>
</div>
);
}
}
ReactDOM.render(
<Clock />,
document.getElementById( 'root' )
);
|
Basic Introduction Of React Native:
REACT Native helps you create real and exciting mobile applications using JavaScript only, which is supportable for both Android and iOS platforms devices. Just code once, and the REACT Native apps are available for both iOS and Android platforms which helps to save a lot of development time. Found great popularity created by Facebook. REACT Native, has a huge community support today. React Native is built on top of ReactJS which is a good alternative to AngularJS. Though there are some similarities and difference between React Native and ReactJS.
React Native
- React Native is a framework that is used to create cross-platform Native apps. It means you can create native apps and the same app will run on Android and ios.
- React native have all the benefits of ReactJS
- React native allows developers to create native apps in web-style approach.
- Front end developer can become mobile developer easily.
Sample React Native code
import React, { Component } from 'react' ;
import { Text, View } from 'react-native' ;
class ReactNative extends Component {
render() {
return (
<View>
<Text>
If you like React on the web, you 'll like React Native.
</Text>
<Text>
You just use native components like ' View ' and ' Text ',
instead of web components like ' div ' and ' span'.
</Text>
</View>
);
}
}
|
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
23 Apr, 2019
Like Article
Save Article