<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Neil Agarwal</title>
    <description>The latest articles on DEV Community by Neil Agarwal (@regalstreak).</description>
    <link>https://dev.to/regalstreak</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F189323%2Ffc841741-ca2f-4904-971c-252cbf26c322.jpeg</url>
      <title>DEV Community: Neil Agarwal</title>
      <link>https://dev.to/regalstreak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/regalstreak"/>
    <language>en</language>
    <item>
      <title>react-native-web tutorial quickstart</title>
      <dc:creator>Neil Agarwal</dc:creator>
      <pubDate>Sat, 10 Aug 2019 19:49:21 +0000</pubDate>
      <link>https://dev.to/regalstreak/quick-start-making-a-pwa-with-react-native-web-4mf8</link>
      <guid>https://dev.to/regalstreak/quick-start-making-a-pwa-with-react-native-web-4mf8</guid>
      <description>&lt;p&gt;So after not finding an updated or proper getting started guide to react-native-web, I decided to create this.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;TLDR&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;To get things going,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;create-react-app my-app&lt;/code&gt;&lt;br&gt;
&lt;code&gt;yarn add react-native-web&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now in &lt;code&gt;src/index.web.js&lt;/code&gt; (create if doesn't exist)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// index.web.js

import App from './App';
import { AppRegistry } from 'react-native';
import * as serviceWorker from './serviceWorker';

// register the app
AppRegistry.registerComponent('App', () =&amp;gt; App);

AppRegistry.runApplication('App', {
    initialProps: {},
    rootTag: document.getElementById('root')
});

serviceWorker.unregister();
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then delete &lt;code&gt;src/App.js&lt;/code&gt; and create &lt;code&gt;src/App.js&lt;/code&gt; again&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// App.js
import React from 'react';
import { Text, View, StyleSheet } from 'react-native';

// react-native-web is aliased to react-native automatically by create-react-app

export default class App extends React.Component {
    render() {
        return (
            &amp;lt;View style={styles.container}&amp;gt;
                &amp;lt;Text style={styles.text}&amp;gt;
                    Welcome to react-native-web
                &amp;lt;/Text&amp;gt;
            &amp;lt;/View&amp;gt;
        )
    }
}

const styles = StyleSheet.create({
    container: {
        alignItems: "center",
        height: "100vh",
        backgroundColor: "black",
        justifyContent: "center"
    },
    text: {
        fontSize: 40,
        color: "silver"
    }
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then just &lt;code&gt;yarn start&lt;/code&gt; and you should view that on the browser on &lt;code&gt;localhost:3000&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;But, what's react-native-web?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;According to &lt;code&gt;necolas&lt;/code&gt;'s github,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React Native for Web&lt;/strong&gt; makes it possible to run React Native components and APIs on the web using &lt;strong&gt;React DOM&lt;/strong&gt;. Check out the live demo of the React Native examples running on the web.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Write once, render anywhere&lt;/strong&gt;: interoperates with existing React DOM components and is compatible with the majority of the React Native API. You can develop new components for native and web without rewriting existing code. React Native for Web can also render to HTML and critical CSS on the server using Node.js.&lt;/p&gt;

&lt;p&gt;Who is using React Native in production web apps? &lt;code&gt;Twitter, Major League Soccer, Flipkart, Uber, The Times, DataCamp&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>reactnativeweb</category>
      <category>react</category>
      <category>pwa</category>
    </item>
  </channel>
</rss>
