What is difference between React/ReactJS and React Native
The main difference between React and React Native is that React is a JavaScript library for building web applications, while React Native is a framework for building mobile apps.
React utilizes HTML, CSS, and JavaScript to create interactive user interfaces, whereas React Native utilizes APIs and native UI components to build mobile applications.
ReactJS used a virtual DOM to render browser code in React, whereas React Native uses Native API to render components for mobile applications.
React is optimized for web performance and works well with standard web technologies. React Native is optimized for mobile and provides smoother, more responsive experiences on mobile devices due to its native components.
visit their official website created by facebook team:
visit their official website of React native:
React code sample:
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
class NewClock 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>Hello, world!</h1>
<h2>It is {this.state.date.toLocaleTimeString()}.</h2>
</div>
);
}
}
ReactDOM.render(
<NewClock />,
document.getElementById('root')
);
React Native code sample:
import React, { Component } from 'react';
import { Text, View } from 'react-native';
class SampleReactNativeClass 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>
);
}
}
React JS?
Javascript library
React is a free and open-source front-end JavaScript library for building user interfaces based on UI components. It is maintained by Meta (the parent company of Facebook) and a growing community of individual developers and development companies.
UI focussed
When React JS was initially released, it essentially brought together the speed of JavaScript and a new way of rendering pages. React is also referred to as React JS, ReactJS and React.js.
React Native?
In 2015, two years after the Facebook team made React JS freely available and its popularity grew, they released React Native.
Open source
React Native is an open-source UI software framework created by Meta. It is used to develop applications for iOS and Android, Web and Windows by enabling developers to use the React framework along with native platform capabilities.
Cross-platform
Another other words, React Native is a cross-platform mobile framework that uses ReactJS for building apps and websites. React Native uses native app components and enables the programmer to build mobile applications.
Recent Comments