React Native for Web
!npm versionpackage-badgepackage-url !Build Statusci-badgeci-url "React Native for Web" makes it possible to run React Nativereact-native-url components and APIs on the web using React DOM.
Documentation
The documentation site (source) covers installation, guides, and APIs.Example
The examples app (source) demonstrates many available features. Fork the codesandbox to make changes and see the results.You'll notice that there is no reference to
react-dom
in components. The App
component that is shown below is defined using the APIs and Components of React Native, but it can also be rendered on the web using React Native for Web.// Example component
import React from 'react';
import { AppRegistry, StyleSheet, Text, View } from 'react-native';
class App extends React.Component {
render() {
return (
<View style={styles.box}>
<Text style={styles.text}>Hello, world!</Text>
</View>
);
}
}
const styles = StyleSheet.create({
box: { padding: 10 },
text: { fontWeight: 'bold' }
});
AppRegistry.registerComponent('App', () => App);
AppRegistry.runApplication('App', { rootTag: document.getElementById('react-root') });