<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Salah Eddine Bachir-Cherif on Medium]]></title>
        <description><![CDATA[Stories by Salah Eddine Bachir-Cherif on Medium]]></description>
        <link>https://medium.com/@gs_bachircherif?source=rss-a274058a3c74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MMafuecqY6Sg76Jn.</url>
            <title>Stories by Salah Eddine Bachir-Cherif on Medium</title>
            <link>https://medium.com/@gs_bachircherif?source=rss-a274058a3c74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:06:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gs_bachircherif/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[React Native : First steps]]></title>
            <link>https://medium.com/@gs_bachircherif/react-native-first-steps-3f4113aff39f?source=rss-a274058a3c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f4113aff39f</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[startup-lessons]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Salah Eddine Bachir-Cherif]]></dc:creator>
            <pubDate>Tue, 28 Aug 2018 16:34:15 GMT</pubDate>
            <atom:updated>2018-08-28T16:36:51.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*SgfD8olgNdJywLJ262Z4YQ.jpeg" /></figure><p>React Native is framework to build mobile apps using only JavaScript. It uses the same design as React, letting you compose a rich mobile UI from declarative components.</p><p><strong>Why React Native?</strong></p><p>Read this article to understand why you should start learning React Native:</p><p><a href="https://medium.com/@thinkwik/react-native-what-is-it-and-why-is-it-used-b132c3581df">React Native: What is it? and, Why is it used?</a></p><p><strong>I want to start learning React Native , what should i do?</strong></p><p>In this article, am going to explain to you about how to get started in RN,</p><p>Requirements to get started:</p><ul><li>A basic understanding of the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript">JavaScript</a><em> </em>language<em>.</em></li><li>A Text editor to write code in it ( i recommend VS code because it support React Native syntax a.k.a JSX ).</li><li>install <a href="https://nodejs.org/en/download/">Node.js</a> and <a href="https://yarnpkg.com/fr/docs/install">Yarn</a>.</li></ul><p>Also there are some required dependencies:</p><p>You need to setup Native SDKs for specific platforms:</p><ul><li><strong>iOS</strong> (install/have Xcode, it is free and most probably pre installed).</li><li><strong>Android</strong> (I’d recommend that you follow instructions <a href="https://facebook.github.io/react-native/docs/getting-started.html">here</a>).</li></ul><p><strong>Let’s get started !</strong></p><p>First, we have to install React Native</p><pre>yarn add React-native-cli</pre><p>Second, we need to initialise our project :</p><p>open the terminal (shell on Linux , cmd on Windows ) and type :</p><pre>react-native init MyFirstApp<br>cd MyFirstApp<br>yarn add react-native@0.55.4 //use this version instead of 0.56</pre><p>after this step, the directory should contain this hierarchy :</p><pre>.babelrc<br>.buckconfig<br>.flowconfig<br>.gitattributes<br>.gitignore<br>.watchmanconfig<br>- android // contains required files for android platform<br>App.js // this file will contain our app<br>app.json // settings of the app<br>index.js // this is the script of entry<br>- ios // contains required files for iOS platform<br>- node_modules // contain react native dependencies<br>package.json<br>yarn.lock</pre><p>to open the directory in VS Code type:</p><pre>code .</pre><p>before making any changes to the code, let’s try to run the app.</p><p>To run the app on Android emulator or your device (if connected) type in terminal:</p><pre>react-native run-android</pre><p>to run it on iOS ( XCode required ), type:</p><pre>react-native run-ios</pre><p>This step should build the app and run it , it will take a time to build so don’t worry, if everything went fine , you should see this error if you are using a real device :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*qSYBMzMqBvR4Fyr0U1PIQQ.jpeg" /></figure><p>and when you type on Reload, this error will appear:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*q3Z4uCRjwiBPvDR251EbkA.jpeg" /></figure><p>those errors are occured because we haven’t allready set the developement server. now click on Dismiss, shake your device, a menu should appear like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*QY6Td0Td4bNR2-lpScvbhg.jpeg" /></figure><p>Enable Live Reload, then go to Dev Settings, look for Debug server host &amp; port for device, in this step your phone and your pc should be on the same network, enter your pc’s IP address and the port 8081, so it will be like this in my case:</p><pre>192.168.1.13:8081</pre><p>if everything went okay, when you exit the Dev Settings, shake your device again to open dev menu, then click on reload, this time our app should work and you will see this screen :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*MybW7cKtwsPJmw0Fq2wh1A.jpeg" /><figcaption>our first app</figcaption></figure><p>If you get this result you are ready to start , if errors still occur means that you missed a step, try again.</p><h4><strong>Time to code !</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f4113aff39f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding React Native Component Lifecycle Api]]></title>
            <link>https://medium.com/@gs_bachircherif/understanding-react-native-component-lifecycle-api-d78e06870c6d?source=rss-a274058a3c74------2</link>
            <guid isPermaLink="false">https://medium.com/p/d78e06870c6d</guid>
            <category><![CDATA[lifecycle]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <dc:creator><![CDATA[Salah Eddine Bachir-Cherif]]></dc:creator>
            <pubDate>Tue, 28 Aug 2018 12:03:12 GMT</pubDate>
            <atom:updated>2019-05-06T20:10:14.363Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*BSgFvRT-lo-8CbCrUCsoAg.jpeg" /></figure><p>While building our application, we always need ways to update its components, e.g adding items to ListView dynamically , in order to do that in the right way, we should understand lifecyle api of React Native</p><p><strong>What is a lifecycle api?</strong></p><p>it is a bunch of functions provided by React Native to instantiate, mount, render, and eventually update,unmount, and destroy components. This api helps us to initialise ,update data in the right way.</p><p><strong>The Component Lifecycle API</strong></p><p>Let’s look at each phase of the component lifecycle. In React Native the Api contains 3major phases : mounting phase, updating phase and unmouting phase, so the order should be :</p><p><strong>Mounting cycle:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*dI2KukXM5fH7pdcs3ogHNg.jpeg" /><figcaption>Mounting cycle</figcaption></figure><p>constructor(props) : this method is used to initialise our component with initial state, no native UI element has been rendered yet, in the next example we are going to initiate our component with sample data, props of component are passed as argument.</p><pre>constructor(props){<br>     super(props);<br>     this.state={<br>           message:&#39;hello world&#39;<br>     };// this will be our initiale data that will upadate later<br>}</pre><p>componentWillMount() : this method is invoked only once before rendring the component for the first time. used generally to fetch data from external api e.g. :</p><pre>componentWillMount(){<br>     fetch(&#39;http://my.api/users&#39;)<br>     .then(res=&gt;res.json()) //to cast the body to an object<br>     .then(res=&gt;this.setState({<br>           data:res<br>     });<br>}</pre><p>render() : the render method must return a React Native component (JSX element ) to render (or null, to render nothing). in this step UI element is rendered , e.g. :</p><pre>render(){<br>    return(<br>      &lt;View&gt;<br>            &lt;Text&gt;{this.state.message}&lt;/Text&gt;<br>      &lt;/View&gt;<br>)};</pre><p>componentDidMount() : this method is also invoked once after the native UI for this component has finished rendering ,this is a good place to do some work on data ,updating the state will invoke the render() method again ( without noticing the previous state ), e.g. :</p><pre>componentDidMount(){<br>      this.setState({<br>          message:&#39;i got changed&#39;<br>     };<br>}</pre><p>if we add this method to our app , user won’t notice the first message ( as mentionned in our constructor ) .</p><p>after this step we will enter to runtime loop, where our app will be in updating cycle, so our component will wait for updates occured either in props or state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*TdVbSACGpSVgMvJoBfrn9g.jpeg" /><figcaption>updating cycle</figcaption></figure><p><strong>if props is updated the lifecyle will be like:</strong></p><p>componentWillReceiveProps(nextProps) : this method will be invoked if the parent of the component has passed new props , so we need to re-render it .</p><p>shouldComponentUpdate(nextProps) : this method returns a boolean whether we need to re-render the component or no, based on changes occured on props</p><p>componentWillUpdate() : this method is invoked when shouldComponentUpdate() returns true inorder to do some extra processing.</p><p>render() : this method is invoked assuming shouldComponentUpdate returned true. so this method must return a React Native element</p><p>componentDidUpdate() : this method is invoked after re-rendring the component</p><p><strong>if state is updated the lifecyle will be like:</strong></p><p>it will be the same steps like when props are updated but omitting the componentWillReceiveProps because the change in state are intern , so the life cycle will be like:</p><p>shouldComponentUpdate() -&gt;componentWillUpdate() -&gt; render()-&gt; componentDidUpdate()</p><p><strong>Finally , the unmouting cycle:</strong></p><p>componentWillUnmount() : This method is called when a component is being removed .</p><figure><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_image"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYxBP_WV7LI6zc-zdUkNqQ.png" /></a></figure><p>📝 Read this story later in <a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_read_later_text">Journal</a>.</p><p>👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. <a href="https://usejournal.com/newsletter/noteworthy-in-tech/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_text">Read the Noteworthy in Tech newsletter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d78e06870c6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>