<?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: Mouhamed aly Sidibe</title>
    <description>The latest articles on DEV Community by Mouhamed aly Sidibe (@mouhamedaly).</description>
    <link>https://dev.to/mouhamedaly</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%2F38439%2Fb419b56a-f366-4c0c-9927-f2e1f12bf2ab.jpg</url>
      <title>DEV Community: Mouhamed aly Sidibe</title>
      <link>https://dev.to/mouhamedaly</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mouhamedaly"/>
    <language>en</language>
    <item>
      <title>Add dark mode to your react native app</title>
      <dc:creator>Mouhamed aly Sidibe</dc:creator>
      <pubDate>Sat, 15 Aug 2020 19:31:01 +0000</pubDate>
      <link>https://dev.to/mouhamedaly/add-dark-mode-to-your-react-native-app-5af4</link>
      <guid>https://dev.to/mouhamedaly/add-dark-mode-to-your-react-native-app-5af4</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GUKpZYEo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A46YXj9rqN2g-cKlhDeRXrQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GUKpZYEo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A46YXj9rqN2g-cKlhDeRXrQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dark Mode was introduced in iOS 13. It adds a darker theme to iOS and allows you to do the same for your app. It’s a great addition to give to your users so they can use your app in a darker design.&lt;/p&gt;

&lt;p&gt;In this blog post, we are going to see how to add it in your react native app very quickly with React navigation v5 and Expo.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create the expo app
&lt;/h4&gt;

&lt;p&gt;if you dont have the expo-cli installed run this before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g expo-cli
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and then :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo init
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Adding navigation
&lt;/h4&gt;

&lt;p&gt;Let’s install React navigation(latest version v5)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add @react-navigation/native
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We need to install a few more libraries for this to work.&lt;/p&gt;

&lt;p&gt;In the project directory, run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will install versions of these libraries that are compatible.&lt;/p&gt;

&lt;p&gt;We have React navigation installed in our project we can start using it by creating a simple stack navigator with 2 screens.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the stack navigator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; yarn add @react-navigation/stack
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Imports
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_import_ { createStackNavigator } _from_ “@react-navigation/stack”;
_import_ { NavigationContainer } _from_ “@react-navigation/native”;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create the stack
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const _Stack_ = _createStackNavigator_();
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cWy5L_3e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATQ6LHPjdsoSa-l54PC1tqw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cWy5L_3e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATQ6LHPjdsoSa-l54PC1tqw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MJKD_Xvb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/656/1%2AZemd40vMXZAf66I9Hh6V9Q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MJKD_Xvb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/656/1%2AZemd40vMXZAf66I9Hh6V9Q.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Adding dark mode support
&lt;/h4&gt;

&lt;p&gt;Now we want to provide light and dark themes based on the user preference.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let’s install react-native-appearance to detect the operating system color scheme preferences.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo install react-native-appearance
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then, in app.json, under the ios key we need to add "userInterfaceStyle": "automatic"
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"ios": {"userInterfaceStyle": "automatic"}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now we can import AppearanceProvider and useColorScheme(return the operating system color scheme)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_import_ { AppearanceProvider, useColorScheme } _from_ “react-native-appearance”;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PrSoyCoo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/978/1%2AOIfUwi41N5ezN97YENcz7A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PrSoyCoo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/978/1%2AOIfUwi41N5ezN97YENcz7A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React navigation provide by default a Dark theme and a defaultTheme we can import it and use it
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_import_ { DefaultTheme, DarkTheme } _from_ “@react-navigation/native”;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YwGaQPUf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A-Pf7_JTCappkI2E42dKp-A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YwGaQPUf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A-Pf7_JTCappkI2E42dKp-A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MSZshYRN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/352/1%2ArGaoEfNQLS1JW29HGxAk4A.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MSZshYRN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/352/1%2ArGaoEfNQLS1JW29HGxAk4A.gif" alt=""&gt;&lt;/a&gt;IphoneXr&lt;/p&gt;

&lt;p&gt;When I change the color scheme of my operating system, the theme of my app changes automatically. Cool 😍&lt;/p&gt;

&lt;p&gt;But we can notice that the text is not displayed when the theme is dark because this is a black text in a black background. We can adjust the text color by using the current theme color text.&lt;/p&gt;

&lt;p&gt;To gain access to the theme in any component that is rendered inside the navigation container: we can use the useTheme hook. It returns the theme object.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wS8P1IpE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATcVQx6MdIWc94yNWpuS3oA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wS8P1IpE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATcVQx6MdIWc94yNWpuS3oA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KWyk5X1g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2AOW1SYLzft5lBXBP3IddTkQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KWyk5X1g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2AOW1SYLzft5lBXBP3IddTkQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OskP64zF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2AevqgBcwcgPfHoHKN2e5o2Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OskP64zF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2AevqgBcwcgPfHoHKN2e5o2Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The colored text automatically adapts to the current schema.&lt;/p&gt;

&lt;h4&gt;
  
  
  Custom themes
&lt;/h4&gt;

&lt;p&gt;Instead of using themes provided by React navigation we can create our own themes.&lt;/p&gt;

&lt;p&gt;A theme is a JS object containing a list of colors to use. It contains the following properties:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dark (boolean): Whether this is a dark theme or a light theme&lt;/li&gt;
&lt;li&gt;colors (object): Various colors used by react navigation components:&lt;/li&gt;
&lt;li&gt;primary (string): The primary color of the app used to tint various elements. Usually you'll want to use your brand color for this.&lt;/li&gt;
&lt;li&gt;background (string): The color of various backgrounds, such as background color for the screens.&lt;/li&gt;
&lt;li&gt;card (string): The background color of card-like elements, such as headers, tab bars etc.&lt;/li&gt;
&lt;li&gt;text (string): The text color of various elements.&lt;/li&gt;
&lt;li&gt;border (string): The color of borders, e.g. header border, tab bar border etc.&lt;/li&gt;
&lt;li&gt;notification (string): The color of Tab Navigator badge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When creating a custom theme, you will need to provide all of these properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1qlN_gPI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAretbq14pi7oUMouZ5Jdtg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1qlN_gPI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAretbq14pi7oUMouZ5Jdtg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vhppGfbX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2AGkNoFgoVbIXfuwVe81BQvA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vhppGfbX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2AGkNoFgoVbIXfuwVe81BQvA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M6t18YdV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2Ax55Io1VKil-gGlJ7nXKmug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M6t18YdV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/828/1%2Ax55Io1VKil-gGlJ7nXKmug.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Done ✅&lt;/p&gt;

&lt;p&gt;This is what i wanted to share with you today, thanks for reading.&lt;/p&gt;

&lt;p&gt;Visit my &lt;a href="https://mouhamedaly.dev"&gt;blog&lt;/a&gt; or my &lt;a href="https://www.youtube.com/channel/UC-Rak9WhKgjARd5NwyYzdlQ?view_as=subscriber"&gt;youtube channel&lt;/a&gt;for more content.&lt;/p&gt;

</description>
      <category>expo</category>
      <category>reactnative</category>
      <category>theming</category>
      <category>reactnavigation5</category>
    </item>
    <item>
      <title>How I Created My Blog With Gatsby</title>
      <dc:creator>Mouhamed aly Sidibe</dc:creator>
      <pubDate>Fri, 26 Jun 2020 19:31:00 +0000</pubDate>
      <link>https://dev.to/mouhamedaly/how-i-created-my-blog-with-gatsby-1762</link>
      <guid>https://dev.to/mouhamedaly/how-i-created-my-blog-with-gatsby-1762</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dt3sE8Uu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APtUVnOsws61QcizGqZ6AYQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dt3sE8Uu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APtUVnOsws61QcizGqZ6AYQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post was originally published in my &lt;a href="https://mouhamedaly.dev/How-I-Created-My-Blog-With-Gatsby"&gt;&lt;em&gt;blog&lt;/em&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As a software developer, one of the best mediums you can use to market yourself is a blog. It’s my firm belief that every software developer who cares about their career should invest in creating a blog.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These words come from a book i am reading : &lt;strong&gt;Soft skills , the software developer’s life manual.&lt;/strong&gt; I definitely recommend you &lt;a href="https://www.amazon.fr/Soft-Skills-software-developers-manual/dp/1617292397"&gt;this book&lt;/a&gt; if you want to know how to succeed in your career as a developer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PNk4ScHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/260/1%2Afb5aGJx3cZRZU0UvsKWB6w.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PNk4ScHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/260/1%2Afb5aGJx3cZRZU0UvsKWB6w.jpeg" alt=""&gt;&lt;/a&gt;Soft Skills&lt;/p&gt;

&lt;p&gt;This book talk a lot about blogging and how it is important. Specially when you are a freelancer or consultant like me, you‘ll find that a successful blog can bring many clients your way instead of having to go find them by yourself.&lt;/p&gt;

&lt;p&gt;Writing articles can also help you become a better developer and communicator because there is a huge work of researching, coding, learning, behind a blog post.&lt;/p&gt;

&lt;p&gt;There’s another good job that’s inspired me a lot: &lt;a href="https://medium.com/@dabit3/the-prosperous-software-consultant-5dc8d705c5dd"&gt;&lt;strong&gt;The Prosperous software consultant&lt;/strong&gt;&lt;/a&gt; by &lt;a href="https://medium.com/u/695782484bda"&gt;Nader Dabit&lt;/a&gt;, he talk about how you can “build bridges” by making content on your blog:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This also goes back to “Building Bridges”, when you learn something new, give that knowledge away, it helps the community and it helps you!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You should definitely read this one too.&lt;/p&gt;

&lt;p&gt;In just 3 or 4 months of consistent writing, I’ve seen a lot of good results. Recently, my article on the Expo for the web was published on the official Expo blog and I was very happy about it.&lt;/p&gt;

&lt;p&gt;I started writing on medium, which is really great and easy to write on. You can do a lot of cool things like importing articles, statistics, etc. But it seems that it’s not really a platform for developers.&lt;/p&gt;

&lt;p&gt;I also tried &lt;a href="http://dev.to"&gt;dev.to&lt;/a&gt; which is a very good platform for developers because 99% are programmers or people learning to code. You can follow me there by the way : &lt;a href="https://dev.to/mouhamedaly"&gt;https://dev.to/mouhamedaly&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally I decided to create my own personal blog. Having my own platform will bring me a lot of benefices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I am not dependent on any other platform&lt;/li&gt;
&lt;li&gt;I can monetize my blog: maybe displaying ads&lt;/li&gt;
&lt;li&gt;I can customize it as i want.&lt;/li&gt;
&lt;li&gt;I can still publish on medium or dev.to and redirect readers to my personal blog.&lt;/li&gt;
&lt;li&gt;Etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I procrastinated for quite a while before starting the development of my blog.&lt;br&gt;&lt;br&gt;
I wasn’t motivated to make my website with classic html css or CMS like wordpress(Im not really fan).&lt;/p&gt;

&lt;p&gt;But one day while doing research I discovered Gatsby and I fell in love.I realized that Gatsby was the perfect tool to create a personal or business website. So i decided to learn it. And for me, &lt;em&gt;the best way to learn is by practicing.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  GATSBY
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JGN5E-C6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ALtqW6FOAzMFveU0P.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JGN5E-C6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2ALtqW6FOAzMFveU0P.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  What is Gatsby ?
&lt;/h4&gt;

&lt;p&gt;Gatsby is a free and open source framework based on React that helps developers build blazing fast &lt;strong&gt;websites&lt;/strong&gt; and  &lt;strong&gt;apps.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Gatsby is generally defined as a powerful static site generator, but very different from other SSGs like jeykill, hugo etc. The particularity of Gatsby is that it allows you to create extremely fast static, progressive and high performance web applications.&lt;/p&gt;
&lt;h4&gt;
  
  
  How it works ?
&lt;/h4&gt;

&lt;p&gt;Gatsby does all the data fetching during build time. No matter where your data come from you can access it in the same way. Gatsby normalize your data into a graphql api so you can read and display them easily.&lt;/p&gt;

&lt;p&gt;At the end gatsby will compile all of this into static assets and then allow you to deploy very quickly your app to a CDN of your choice rather than a traditional server.&lt;/p&gt;

&lt;p&gt;Here is a graphic that summarize it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fIFi-E6z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AWmQ-xuhDBxxgV8oyip356Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fIFi-E6z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AWmQ-xuhDBxxgV8oyip356Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Getting started
&lt;/h3&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Gatsby CLI&lt;/strong&gt;
&lt;/h4&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g gatsby-cli
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The above command installs Gatsby CLI globally on your machine so you can use all these commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create new project&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gatsby new gatsby-site
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Start project&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gatsby develop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Build project&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gatsby build
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Gatsby Starter&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The Gatsby CLI tool lets you install &lt;strong&gt;starters&lt;/strong&gt; , which are boilerplate Gatsby sites maintained by the community and intended for jump-starting development quickly.&lt;/p&gt;

&lt;p&gt;For example if you want to create a blog, you can use the blog starter instead of starting coding from scratch. All the gatsby starters can be found &lt;a href="https://www.gatsbyjs.org/starters?v=2"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I found a very nice &lt;a href="https://www.gatsbyjs.org/starters/W3Layouts/gatsby-starter-delog/"&gt;starter blog&lt;/a&gt; which I used to quickly get up-and-running.&lt;/p&gt;

&lt;p&gt;With this starter I have access to a lot of features like netlify CMS that we will see in the next section, that’s what’s cool about gatsby starters.&lt;/p&gt;

&lt;p&gt;I initialized a new project with this starter by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gatsby new blog [https://github.com/W3Layouts/gatsby-starter-delog](https://github.com/W3Layouts/gatsby-starter-delog)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This command downloads the files and initializes the site by running npm install.&lt;/p&gt;

&lt;p&gt;After that i can run my app :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd blog 

gatsby develop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Gatsby will start a hot-reloading development environment accessible by default at &lt;a href="http://localhost:8000."&gt;http://localhost:8000&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Customizing:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;By default the starter looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AayrpzE4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Acm-HaS-GRULjv6NszTOrGw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AayrpzE4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Acm-HaS-GRULjv6NszTOrGw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After some customization it’s now look like this. I changed colors , added a avatar, changed the fonts etc :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mXwwcgZa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AJ_FZLnpL-r80ttMxCTy_1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mXwwcgZa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AJ_FZLnpL-r80ttMxCTy_1g.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can customize your app as you want , it’s just html, css and react.&lt;/p&gt;

&lt;p&gt;By the way I created &lt;a href="https://www.gatsbyjs.org/starters/Sidibedev/expo-gatsby-starter/"&gt;my own starter&lt;/a&gt; if you want to start a &lt;a href="http://expo.io"&gt;Expo&lt;/a&gt;/Gatsby project.&lt;/p&gt;

&lt;h4&gt;
  
  
  Gatsby Plugins
&lt;/h4&gt;

&lt;p&gt;Basically Gatsby plugins are just Node packages, so you can install them like other packages in node using NPM.&lt;/p&gt;

&lt;p&gt;You need Google analytics? There’s &lt;a href="https://www.gatsbyjs.org/packages/gatsby-plugin-google-analytics"&gt;a plugin&lt;/a&gt; for that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install — save gatsby-plugin-google-analytics
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You need offline support? There’s &lt;a href="https://www.gatsbyjs.org/packages/gatsby-plugin-offline"&gt;a plugin&lt;/a&gt; for that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install — save gatsby-plugin-offline
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In short there is a plugin for everything you want to do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Netlify and Netlify CMS
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Netlify
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt; : Netlify is a platform you can use to automatically build, deploy, serve, and manage your frontend sites and web apps.&lt;/p&gt;

&lt;p&gt;There are really a lot of advantages to using netlify in a gatsby site.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Continuous integration&lt;/strong&gt;  : Every time i push my code to github, netlify build a new version of my app and deploy it. I have nothing to do, that’s super cool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forms&lt;/strong&gt;  : I have a contact form in my website, so that users can write me. Netlify comes with built-in form handling. I just have to add thenetlify attribute or data-netlify="true" to the  tag, and i can start receiving messages in my Netlify site admin panel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domain Settings&lt;/strong&gt; : I added my custom domain &lt;a href="https://mouhamedaly.dev"&gt;&lt;strong&gt;mouhamedaly.dev&lt;/strong&gt;&lt;/a&gt; directly from the netlify admin panel. In just a few minutes my domain was available&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Netlify CMS
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt; : Netlify CMS is an &lt;strong&gt;open source headless content management system&lt;/strong&gt; which can be used with any static site generator to construct a faster and flexible web app. Netlify CMS is fully extensible, platform agnostic, easy to install and provides a friendly UI to the users.&lt;/p&gt;

&lt;p&gt;A CMS is useful because you can add content like blog posts from a dashboard on your website, instead of having to add posts manually with Markdown.&lt;/p&gt;

&lt;p&gt;Netlify CMS is preinstalled in this starter, no configuration needed. After starting the app i can access to my netlify cms dashboard at &lt;a href="http://localhost:8000/admin"&gt;http://localhost:8000/admin&lt;/a&gt; and add new post.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Wb8ZTX---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APxCXugpaVe-_DilA6V83wA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Wb8ZTX---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APxCXugpaVe-_DilA6V83wA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8qlQOQrM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AXM9ikKQD07CtBowYMj3E9Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8qlQOQrM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AXM9ikKQD07CtBowYMj3E9Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every time I add a new post, the content will be stored in my repository and versioned on GitHub because Netlify CMS is Git-based. Also, thanks to &lt;a href="https://www.netlify.com/docs/continuous-deployment/"&gt;Netlify’s Continuous Deployment&lt;/a&gt;, a new version will be deployed every time i add or edit a post. This is awesome.&lt;/p&gt;

&lt;h3&gt;
  
  
  SEO
&lt;/h3&gt;

&lt;p&gt;The better you optimize your blog for &lt;strong&gt;SEO&lt;/strong&gt; , the higher your website will be listed on search engine result pages, so more people can find your website.&lt;/p&gt;

&lt;p&gt;Using Gatsby makes your site fast and efficient for search engine crawlers to index your pages.&lt;/p&gt;

&lt;p&gt;Gatsby is Good at SEO because gatsby pages are &lt;strong&gt;server side rendered&lt;/strong&gt; and all the page content is available to search engine crawlers&lt;/p&gt;

&lt;p&gt;Right click -&amp;gt; View page source&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a-sJ9IYf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/640/1%2ApwydaZHGZKeMSRQ92usv6Q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a-sJ9IYf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/640/1%2ApwydaZHGZKeMSRQ92usv6Q.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some tricks i used to improve my SEO&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;React Helmet&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Meta tags are very important for SEO. They tell search engines important information about your web page, such as how they should display it in search results.&lt;/p&gt;

&lt;p&gt;React helmet is the plugin i used to add meta data into my web pages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X-yC6dVB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AlT1iYH63iQyjoAU6tMlkPQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X-yC6dVB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AlT1iYH63iQyjoAU6tMlkPQ.png" alt=""&gt;&lt;/a&gt;React helmet&lt;/p&gt;

&lt;p&gt;With this plugin, attributes you add to your components, e.g. title, meta attributes, etc. will get added to the static HTML pages Gatsby builds.&lt;/p&gt;

&lt;h4&gt;
  
  
  Sitemap
&lt;/h4&gt;

&lt;p&gt;An sitemap is a XML file that lists all your website pages, making sure Google can find and crawl them all, also helping it understand your website structure.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.gatsbyjs.org/packages/gatsby-plugin-sitemap/"&gt;&lt;strong&gt;gatsby-plugin-sitemap&lt;/strong&gt;&lt;/a&gt; plugin allows you to automatically generate a sitemap with Gatsby and then bots can discover all your pages.&lt;/p&gt;

&lt;p&gt;Eh voila :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uWZ2N-pQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AwsJOshmoF_ohkxhtyRk4SA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uWZ2N-pQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AwsJOshmoF_ohkxhtyRk4SA.png" alt=""&gt;&lt;/a&gt;LightHouse SEO Test&lt;/p&gt;

&lt;h3&gt;
  
  
  PWA
&lt;/h3&gt;

&lt;p&gt;I really like progressive web apps. It was very important for me to have a pwa for my personal blog so users can download it like a native app.&lt;/p&gt;

&lt;p&gt;The starter I used already had offline support, so I didn’t have to configure anything.Gatsby is usually is best defined as a pwa generator instead of a static site generator.&lt;/p&gt;

&lt;p&gt;They give you all your need to build a &lt;a href="https://www.gatsbyjs.org/docs/progressive-web-app/"&gt;true PWA&lt;/a&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.gatsbyjs.org/packages/gatsby-plugin-manifest"&gt;&lt;strong&gt;gatsby-plugin-manifes&lt;/strong&gt; t&lt;/a&gt; : This makes it possible for users to add your app to their home screen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RhWyn9Q6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/222/1%2Aw_L_ZeKjAut_E3vfu9XzaQ.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RhWyn9Q6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/222/1%2Aw_L_ZeKjAut_E3vfu9XzaQ.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.gatsbyjs.org/packages/gatsby-plugin-offline"&gt;&lt;strong&gt;gatsby-plugin-offline&lt;/strong&gt;&lt;/a&gt; ** :** Even in offline mode , the user can still navigate into my app and read my blog posts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i2dJhuAT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Avp7aot3JOh6YI8qJ25r2hQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i2dJhuAT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Avp7aot3JOh6YI8qJ25r2hQ.png" alt=""&gt;&lt;/a&gt;PWA TEST&lt;/p&gt;

&lt;h3&gt;
  
  
  Adaptive loading
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=puUPpVrIRkc"&gt;Adaptive Loading&lt;/a&gt; is a web performance pattern where sites not just respond based on screen size — they adapt based on actual device hardware.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;To be a good developer you should also be mindful on all aspects, not only those that the end user see. You must care about performance independently of who is using the app, which device loads it or the time you have to wait for it to be ready.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After reading many articles about Adaptive loading i decided to include it in my website but this pattern has nothing to do with gatsby. You can add in any react app.&lt;/p&gt;

&lt;p&gt;There is a library called &lt;a href="https://github.com/GoogleChromeLabs/react-adaptive-hooks"&gt;react-adaptive-hooks&lt;/a&gt; that provided a suite of React Hooks for adaptive loading based on a user’s network, data saving preferences, device memory and logical CPU cores.&lt;/p&gt;

&lt;p&gt;I can use this React library inside my gatsby project because gatsby is a React framework.&lt;/p&gt;

&lt;p&gt;So I can check the type of internet connection of the users and according to that decide what to display to them.&lt;/p&gt;

&lt;p&gt;Installation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add react-adaptive-hooks
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Import :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useNetworkStatus } _from_ “react-adaptive-hooks/network”;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Hook :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { effectiveConnectionType } = useNetworkStatus();
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Usage : If the user has a slow connection i show a SVG avatar image instead of showing my PNG avatar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q4DdOYre--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Afxsws4buAS1mWRFj15ZGSw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q4DdOYre--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Afxsws4buAS1mWRFj15ZGSw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n0ucS09A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/640/1%2AE9mExPoRcfg6ICi16OmShA.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n0ucS09A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/640/1%2AE9mExPoRcfg6ICi16OmShA.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using these hooks and utilities can help you give users a great experience best suited to their device and network constraints.&lt;/p&gt;

&lt;h3&gt;
  
  
  Image optimization
&lt;/h3&gt;

&lt;p&gt;Large, unoptimized images dramatically slow down your site.&lt;/p&gt;

&lt;p&gt;If you want to optimize your images, there is &lt;a href="https://www.gatsbyjs.org/packages/gatsby-image/"&gt;&lt;strong&gt;gatsby-image&lt;/strong&gt;&lt;/a&gt; for you.&lt;/p&gt;

&lt;p&gt;Gatsby image solve this &lt;a href="https://www.gatsbyjs.org/packages/gatsby-image#problem"&gt;problem&lt;/a&gt; by bringing this &lt;a href="https://www.gatsbyjs.org/packages/gatsby-image#solution"&gt;solution&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I can lazy load my images and have a nice blur up effect:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iKwkKFDs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2AzdVm8fjuW7jGsRFXRNeA4w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iKwkKFDs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2AzdVm8fjuW7jGsRFXRNeA4w.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more info on how to install and use the gatsby-image plugin : visit this &lt;a href="https://www.gatsbyjs.org/packages/gatsby-image/?="&gt;page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are so many cool things I haven’t mentioned in this article but you can go further and discover gatsby. Their documentation is very well done and the community is very nice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why you should use gatsby ?
&lt;/h3&gt;

&lt;p&gt;Gatsby is a very good framework if you want to build blazing fast &lt;strong&gt;websites&lt;/strong&gt; and &lt;strong&gt;apps very quickly.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Gatsby make it Simple
&lt;/h4&gt;

&lt;p&gt;Getting started with modern web development is complicated, you have to care about a lot of thing like webpack, postcss, app performance, deployment etc.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Things are easy with gatsby, you don’t need to worry about all that boilerplate.&lt;/li&gt;
&lt;li&gt;There a plenty of free starters available you can use to quickly get started.&lt;/li&gt;
&lt;li&gt;There is a plugin for everything you want to do.&lt;/li&gt;
&lt;li&gt;SEO friendly&lt;/li&gt;
&lt;li&gt;Progressive web apps generator&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Gatsby is fun&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Gatsby is built on popular technologies like React and Graphql, so you won’t need to learn a new stack from scratch. If you like creating websites with React and Graphql, you’ll love Gatsby.&lt;/p&gt;

&lt;p&gt;Gatsby lets you pull your data from wherever you want: API , markdown files, databases, CMSs like Wordpress and make it available through a graphql API, that’s pretty cool.&lt;/p&gt;

&lt;h4&gt;
  
  
  Gatsby is performant
&lt;/h4&gt;

&lt;p&gt;Stop worrying about performance in your web app, Gatsby take care of it for you. Gatsby sites are very very fast.&lt;/p&gt;

&lt;p&gt;Here’s what makes gatsby sites very performant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gatsby follows Google’s &lt;a href="https://developers.google.com/web/fundamentals/performance/prpl-pattern/"&gt;PRPL&lt;/a&gt; architectural pattern: &lt;strong&gt;Push&lt;/strong&gt;  , &lt;strong&gt;Precash&lt;/strong&gt; , &lt;strong&gt;Prerender&lt;/strong&gt; , &lt;strong&gt;Lazyload.&lt;/strong&gt; and other performance best practices&lt;/li&gt;
&lt;li&gt;Generates only static assets : no server needed&lt;/li&gt;
&lt;li&gt;Normalizes third party data&lt;/li&gt;
&lt;li&gt;It supports code splitting, enabling &lt;a href="https://developers.google.com/web/fundamentals/performance/critical-rendering-path/"&gt;progressive rendering&lt;/a&gt; for your content.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gatsby does a lot of optimization for us out of the box.&lt;/p&gt;

&lt;p&gt;As a developer, my experience with Gatsby has been wonderful. I really enjoyed building my website with Gatsby ❤️. You should try it, you won’t be disappointed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You also might like to take a look at my other articles:&lt;/em&gt; &lt;a href="https://mouhamedaly.dev"&gt;&lt;strong&gt;&lt;em&gt;https://mouhamedaly.dev&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;h4&gt;
  
  
  References:
&lt;/h4&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/hkiLfE22C2Q"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/UvO7h_KwgpE"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/8t0vNu2fCCM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>blog</category>
      <category>gatsby</category>
      <category>seo</category>
      <category>web</category>
    </item>
    <item>
      <title>Create and Deploy Web Apps and PWAs with Expo</title>
      <dc:creator>Mouhamed aly Sidibe</dc:creator>
      <pubDate>Fri, 15 May 2020 17:11:01 +0000</pubDate>
      <link>https://dev.to/expolovers/create-and-deploy-web-apps-and-pwas-with-expo-3bh2</link>
      <guid>https://dev.to/expolovers/create-and-deploy-web-apps-and-pwas-with-expo-3bh2</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: This article was&lt;/em&gt; &lt;a href="https://dev.to/mouhamedaly/expo-pour-le-web-2kc2-temp-slug-8852498"&gt;&lt;em&gt;originally written in French&lt;/em&gt;&lt;/a&gt; &lt;em&gt;by our guest blogger,&lt;/em&gt; &lt;a href="https://medium.com/u/1ada57a98f84"&gt;&lt;em&gt;Mohamed aly sidibe&lt;/em&gt;&lt;/a&gt;&lt;em&gt;, who translated it to cross-post here. Thanks, Mohamed!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qj3Mx9bt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AFSswaFfJhtBuvwXtjc6eRw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qj3Mx9bt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AFSswaFfJhtBuvwXtjc6eRw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Expo is an amazing tool which lets you create not only Android and iOS mobile applications but also web apps and progressive web applications (PWA) very easily from one single Javascript and React codebase 😍.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EgfqxzpW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/480/1%2A0ZSoKvS3RnIkODAA2HcUaw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EgfqxzpW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/480/1%2A0ZSoKvS3RnIkODAA2HcUaw.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, we will explore all the steps from the creation of an Expo web project to its deployment on Netlify.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QMpGW6O9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/500/1%2AZ6oha4SEnP8fTSyDAqg4JA.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QMpGW6O9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/500/1%2AZ6oha4SEnP8fTSyDAqg4JA.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re new to Expo, I’ve made a series of videos about Expo available on &lt;a href="https://www.youtube.com/channel/UC-Rak9WhKgjARd5NwyYzdlQ"&gt;Youtube&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works 🛠
&lt;/h3&gt;

&lt;p&gt;Developing for the web is just like you‘re developing your Expo mobile app. You’ll use the same components (View, Text, etc.) that will be executed on the web. In addition, you have access to almost all the Expo SDK Features.&lt;/p&gt;

&lt;h3&gt;
  
  
  Our web app
&lt;/h3&gt;

&lt;p&gt;In this guide, we’ll create a simple web app that lets users to upload a picture from their computer, and (if they choose) rotate the image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SrjZ6h6I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AtGHAV9yItR_FISNYM7HGqQ.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SrjZ6h6I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AtGHAV9yItR_FISNYM7HGqQ.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the project 💡
&lt;/h3&gt;

&lt;p&gt;We need to install &lt;a href="https://expo.io/tools#cli"&gt;expo-cli&lt;/a&gt; to create a Expo project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g expo-cli
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This lets us use expo-cli to create a fresh Expo project by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo init
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W8JyvaOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/810/1%2Acz--IjVLepNB6tOTcNsTYg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W8JyvaOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/810/1%2Acz--IjVLepNB6tOTcNsTYg.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Done ✅&lt;/p&gt;

&lt;p&gt;If you look in the app.json file under platforms, you can see that our app is executable on the web. That’s pretty cool.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H_d5CRB3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/712/1%2AcgCk3RPSkbNof7ztO0A0FA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H_d5CRB3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/712/1%2AcgCk3RPSkbNof7ztO0A0FA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run the project 🚗
&lt;/h3&gt;

&lt;p&gt;Now let’s run our Expo project on the web:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo start -w
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When you run this command, your app will automatically launch in your browser:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o2qcdSVM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AHMV9wQc_9PC9CA83OYxu1A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o2qcdSVM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AHMV9wQc_9PC9CA83OYxu1A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s cool: we just created our first web app with Expo! 🎉🎉🎉🎊&lt;/p&gt;

&lt;h3&gt;
  
  
  Develop the app 💻
&lt;/h3&gt;

&lt;p&gt;We’ll need to install two of the Expo SDK modules for the app we have mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;expo-image-picker,&lt;/strong&gt; to pick an image from the user’s gallery or camera
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo install **expo-image-picker**
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;expo-image-manipulator,&lt;/strong&gt; to manipulate images (flipping, rotating, etc.)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo install **expo-image-manipulator**
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After that, we can import them into our app.js file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import \* as ImagePicker _from_ 'expo-image-picker';

import \* as ImageManipulator _from_ 'expo-image-manipulator';
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let’s declare our state, which will contain the uri of the selected image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [selectedImage, setSelectedImage] = React.useState(“”);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Our upload function will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sMynvYuG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AdGHDzcKRK_bnZW9C52sCTg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sMynvYuG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AdGHDzcKRK_bnZW9C52sCTg.png" alt=""&gt;&lt;/a&gt;Upload function&lt;/p&gt;

&lt;p&gt;And our rotate function:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xiRGRDO8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AEm_udQRVmfz0iM8EfHNBEw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xiRGRDO8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AEm_udQRVmfz0iM8EfHNBEw.png" alt=""&gt;&lt;/a&gt;Rotate function&lt;/p&gt;

&lt;p&gt;A simple view containing our upload button, our rotate button and the selected image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N_nqKVo9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1H2rYKtmNCONBDWyyIhbPA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N_nqKVo9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1H2rYKtmNCONBDWyyIhbPA.png" alt=""&gt;&lt;/a&gt;Render&lt;/p&gt;

&lt;h4&gt;
  
  
  DEMO: write once, run everywhere!
&lt;/h4&gt;

&lt;p&gt;The same code is runs here on the web and also on an iOS phone — Expo is multi-platform!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4RrbM34---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/584/1%2AHi1FoH_KhjaRSXj45TYtaw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4RrbM34---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/584/1%2AHi1FoH_KhjaRSXj45TYtaw.gif" alt=""&gt;&lt;/a&gt;Web app&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uq2J4W59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/392/1%2AXYNBJwyM9yPZtfv6VV4Flw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uq2J4W59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/392/1%2AXYNBJwyM9yPZtfv6VV4Flw.gif" alt=""&gt;&lt;/a&gt;Native Mobile app&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploying the app 🚀
&lt;/h3&gt;

&lt;p&gt;Now, we’re going to deploy our app so others can use it.&lt;/p&gt;

&lt;h4&gt;
  
  
  BUILD
&lt;/h4&gt;

&lt;p&gt;Building with Expo is so easy: you can build your app in just one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo build:web
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This command builds our app and savse the final product inside the build folder: &lt;strong&gt;web-build&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kZ4iPvfv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_ifgp5_G_aVs9aUpAIeBhg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kZ4iPvfv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_ifgp5_G_aVs9aUpAIeBhg.png" alt=""&gt;&lt;/a&gt;Build&lt;/p&gt;

&lt;p&gt;If you want to test your app locally, just run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx serve web-build
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and open : &lt;a href="http://localhost:5000"&gt;http://localhost:5000&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  DEPLOYMENT
&lt;/h4&gt;

&lt;p&gt;We can easily deploy our app with Netlify.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the netlify-cli globally:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install netlify-cli -g
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Deploy:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netlify deploy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5xg-_PO3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/1008/1%2As-lY35wb3a2r0Y6zigjzkw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5xg-_PO3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/1008/1%2As-lY35wb3a2r0Y6zigjzkw.gif" alt=""&gt;&lt;/a&gt;Déploiement netlify&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FHVlokQL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AZydDJ8GS_stDpCvt7FYTtg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FHVlokQL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AZydDJ8GS_stDpCvt7FYTtg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  *&lt;em&gt;Our app is now live *&lt;/em&gt; 🎉🎉🎉🎉
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VL33EGTF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A2bkeAVlzDFR0ZkWkUXrm9g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VL33EGTF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A2bkeAVlzDFR0ZkWkUXrm9g.png" alt=""&gt;&lt;/a&gt;App live&lt;/p&gt;

&lt;h4&gt;
  
  
  Continuous delivery
&lt;/h4&gt;

&lt;p&gt;Netlify enables continuous delivery: with this setup, every time you push your code to git, Netlify will automatically deploy your site with the newest code. Here’s how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://app.netlify.com/signup"&gt;Start a new Netlify project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Pick your Git hosting service and select your repository&lt;/li&gt;
&lt;li&gt;Click Build your site&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can test our final app &lt;a href="https://5eb5c036ddc1b083156f7c95--imagerotation.netlify.app/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Progressive Web Apps (PWA) 🎁
&lt;/h3&gt;

&lt;p&gt;Something really cool with building web apps with Expo is that &lt;strong&gt;by default&lt;/strong&gt; your web app is a &lt;strong&gt;progressive web app&lt;/strong&gt;  — you don’t need to do anything special to enable PWAs. That’s awesome 🎊&lt;/p&gt;

&lt;p&gt;PWAs are installable:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J5ulqN5m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A152VAy4MEzG_Kp-_xlhz-A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J5ulqN5m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A152VAy4MEzG_Kp-_xlhz-A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zmJWaT48--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AQURoPTVC3o2WRuV7nLh9VQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zmJWaT48--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AQURoPTVC3o2WRuV7nLh9VQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s now essentially a desktop app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BcqIE2ZZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/656/1%2Ater4XsvVfcEg8kkMalxYSA.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BcqIE2ZZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/656/1%2Ater4XsvVfcEg8kkMalxYSA.gif" alt=""&gt;&lt;/a&gt;PWA&lt;/p&gt;

&lt;p&gt;When you access the site via a smartphone, you can also install it so that the app is accessible from the home screen of your phone like a Native app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PlBm4gY_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/376/1%2AxBlxCMbpo2uWlYc-44N31w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PlBm4gY_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/376/1%2AxBlxCMbpo2uWlYc-44N31w.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is just a default PWA with basics configurations; there’s a &lt;a href="https://docs.expo.io/guides/progressive-web-apps/"&gt;guide&lt;/a&gt; if you want to customize your PWA.&lt;/p&gt;

&lt;p&gt;And that’s all you need to do to create and deploy a mobile app, web app and a PWA with Expo.&lt;/p&gt;

&lt;p&gt;The code is available on &lt;a href="https://github.com/Sidibedev/ExpoImageRotation"&gt;GitHub&lt;/a&gt;. Thanks &lt;a href="https://medium.com/u/16b715de038f"&gt;Evan Bacon&lt;/a&gt; for this amazing work. Thanks for reading and share if you found this article helpful. 😀🚀&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was written by our awesome guest-blogger,&lt;/em&gt; &lt;a href="https://medium.com/u/1ada57a98f84"&gt;&lt;em&gt;Mohamed aly sidibe&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. You can follow him here&lt;/em&gt; &lt;a href="https://medium.com/@sidibemouhamed"&gt;&lt;em&gt;on Medium&lt;/em&gt;&lt;/a&gt; &lt;em&gt;or&lt;/em&gt; &lt;a href="https://twitter.com/mouhamedaly01"&gt;&lt;em&gt;on Twitter&lt;/em&gt;&lt;/a&gt; &lt;em&gt;to keep in touch.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>webdev</category>
      <category>progressivewebapp</category>
      <category>mobileappdevelopme</category>
      <category>react</category>
    </item>
    <item>
      <title>Automatisez vos déploiements Expo avec Bitbucket Pipelines</title>
      <dc:creator>Mouhamed aly Sidibe</dc:creator>
      <pubDate>Sun, 26 Apr 2020 20:01:42 +0000</pubDate>
      <link>https://dev.to/expolovers/automatisez-vos-deploiements-expo-avec-bitbucket-pipelines-lij</link>
      <guid>https://dev.to/expolovers/automatisez-vos-deploiements-expo-avec-bitbucket-pipelines-lij</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CftqL0yt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AuZ0HuLOmdSCRCeBPdkViqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CftqL0yt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AuZ0HuLOmdSCRCeBPdkViqg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;L’un des avantages d’utiliser Expo c’est de pouvoir tester votre application sur Android ou IOS très facilement sans avoir à acheter un &lt;em&gt;apple developer account&lt;/em&gt; à 99$/an 😞, ou à générer un APK qu’il va falloir transférer par Dropbox ou Drive 😩.&lt;/p&gt;

&lt;p&gt;Grace au Expo client ❤️ vous pouvez rendre disponible votre application à travers un lien. Vous avez juste à partager ce lien avec vos Beta-testeurs pour les permettre de tester rapidement votre application. 📱&lt;/p&gt;

&lt;p&gt;Quand vous modifiez votre code et vous publiez à nouveau tous vos utilisateurs vont recevoir la nouvelle version de votre app sans pour autant réinstaller l’app ou installer la MAJ depuis les stores, C’est le Over the air 💨&lt;/p&gt;

&lt;p&gt;Vous voulez connaitre la magie derrière ? Je l’explique &lt;a href="https://medium.com/@sidibemouhamed/10-raisons-pour-lesquelles-jaime-expo-f19b6ecfe369"&gt;ici&lt;/a&gt; 🧐&lt;/p&gt;

&lt;p&gt;Dans cet article nous allons voir comment automatiser le processus de publication d’une nouvelle release afin qu’elle soit directement disponible dans le Expo client à chaque nouveau push. ☁️&lt;/p&gt;

&lt;h3&gt;
  
  
  Comment publier ? 💻
&lt;/h3&gt;

&lt;p&gt;Pour publier une application dans le Expo client et ainsi la rendre disponible à travers un lien on exécute qu’une seule commande:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ expo publish
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Ici nous ne spécifions pas de &lt;em&gt;release channel&lt;/em&gt;. donc notre app sera déployée dans la _release channel _default.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; expo publish équivaut à expo publish --release-channel default
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Les &lt;em&gt;releases channel&lt;/em&gt; sont la pour créer différents environnements de travail pour vous. Vous pouvez avoir autant de &lt;em&gt;release channel&lt;/em&gt; que vous voulez.&lt;/p&gt;

&lt;p&gt;Dans cet article nous allons utilisé 2 &lt;em&gt;releases channel&lt;/em&gt;, une pour un environnement de test : &lt;strong&gt;staging&lt;/strong&gt;  , et l’autre pour notre environnement de production : &lt;strong&gt;production.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;En général les &lt;em&gt;releases channel&lt;/em&gt; sont liés à nos branches. On va naturellement donc avoir notre branche master(production) et une branche develop(staging).&lt;/p&gt;

&lt;p&gt;Du coup si on veut déployer en staging on fait :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo publish --release-channel staging
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Et si on veut déployer en production on fait :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo publish --release-channel production
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Ici le problème c’est que ce n’est pas automatisé. Nous développeurs nous aimons automatiser les choses parce qu’on est paresseux 😂.&lt;/p&gt;

&lt;p&gt;L’idée c’est d’automatiser le processus de telle sorte que quand on push sur develop notre app est directement déployée sur Staging , quand on push sur master notre app est déployée en production.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comment Automatiser ? ⏱
&lt;/h3&gt;

&lt;p&gt;Les pipelines Bitbucket nous permettent d’automatiser notre process de déploiement très facilement. Il existe d’autre providers comme Github actions , gitlab , Circle CI etc. Dans cet article nous allons utiliser Bitbucket 🤪.&lt;/p&gt;

&lt;h4&gt;
  
  
  Etape 1 : Configuration de Expo 🔧🔨
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Créer un compte Expo: Il nous faut un compte expo pour pouvoir publier nos apps. Pour créer un nouveau compte on se rend sur &lt;a href="http://expo.io"&gt;expo.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Créer un projet expo avec la commande &lt;strong&gt;expo init&lt;/strong&gt; ou utilisez un projet existant.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Etape 2 : Configuration de Bitbucket 🔧🔨
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Créer un repo bitbucket.&lt;/li&gt;
&lt;li&gt;S’assurer de faire un &lt;em&gt;npm i&lt;/em&gt; qui va générer un fichier package.lock.json avant le push.&lt;/li&gt;
&lt;li&gt;Faire un push du code source sur le repo distant.&lt;/li&gt;
&lt;li&gt;Activer les pipelines dans l’onglet pipelines de votre projet et choisissez le JS comme langage de programmation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fLbCNyOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AUQR3xEHM5BzOncoYM5gMVA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fLbCNyOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AUQR3xEHM5BzOncoYM5gMVA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5LDmC99I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AeI9aWwyHcEF0bScrMB8gpA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5LDmC99I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AeI9aWwyHcEF0bScrMB8gpA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Après avoir choisi le JS comme langage, un fichier &lt;strong&gt;bitbucket-pipelines.yml&lt;/strong&gt; sera généré , c’est le fichier de configuration et c’est la que tout va se passer. Ne modifiez rien pour le moment et faites juste le commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xtwTqUeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AHaSZnoqPpChmeYTMZtzyng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xtwTqUeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AHaSZnoqPpChmeYTMZtzyng.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sauvegardez vos identifiants expo dans vos variables d’environnement. On en aura besoin dans le bitbucket-pipelines.yml pour nous connecter à expo. Allez dans &amp;gt; Repository settings &amp;gt; Repository variables puis ajoutez votre username et votre mot de passe 🔑.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hRr6lLyv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AT6CkV-_BI8n6hkE5FuABwQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hRr6lLyv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AT6CkV-_BI8n6hkE5FuABwQ.png" alt=""&gt;&lt;/a&gt;Variables d’env&lt;/p&gt;

&lt;h4&gt;
  
  
  Etape 3 : Déploiement 🚀
&lt;/h4&gt;

&lt;p&gt;Pour automatiser notre déploiement nous allons principalement nous baser sur le fichier de configuration &lt;strong&gt;bitbucket-pipelines.yml&lt;/strong&gt;. Dans ce fichier nous allons décrire étape par étape ce qu’il faut faire quand il ya un nouveau push en fonction des branches.&lt;/p&gt;

&lt;p&gt;Le fichier est déjà dans votre projet vous pouvez l’ouvrir et y coller ceci : cliquez &lt;a href="https://gist.github.com/Sidibedev/17114176ffdf82090bddcd1df3b166c3"&gt;ici&lt;/a&gt; pour copier.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1qDdPFsf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AEFFiyJQrQ2pNbeuQsG1VHQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1qDdPFsf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AEFFiyJQrQ2pNbeuQsG1VHQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dans cette configuration nous spécifions deux branches master pour déployer en production et develop pour déployer en staging.&lt;/p&gt;

&lt;p&gt;Vous pouvez créer une branche develop à partir de master et faire un commit pour tester , vous verrez que votre app sera déployée sur expo avec le lien :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://exp.host/@USERNAME/PROJECT?release-channel=CHANNEL"&gt;&lt;em&gt;https://exp.host/@USERNAME/PROJECT?release-channel=&lt;/em&gt;&lt;/a&gt;&lt;em&gt;staging&lt;/em&gt; 🌏&lt;/p&gt;

&lt;p&gt;de même que la branche master&lt;/p&gt;

&lt;p&gt;&lt;a href="https://exp.host/@USERNAME/PROJECT?release-channel=CHANNEL"&gt;&lt;em&gt;https://exp.host/@USERNAME/PROJECT?release-channel=&lt;/em&gt;&lt;/a&gt;&lt;em&gt;production&lt;/em&gt; 🌏&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HOIf5QcA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AjYn83LaHB7XWOQkivX1IYQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HOIf5QcA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AjYn83LaHB7XWOQkivX1IYQ.png" alt=""&gt;&lt;/a&gt;Déploiement en Staging&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OvTQ5X-G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AxufmNyEf9LXMfzI-bJuQ0Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OvTQ5X-G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AxufmNyEf9LXMfzI-bJuQ0Q.png" alt=""&gt;&lt;/a&gt;Déploiement en production&lt;/p&gt;

&lt;p&gt;Et dans l’onglet déploiements vous pouvez voir vos déploiements&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7fKw3NMO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A8QFPmh3mXrvQ8iucH8pjSw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7fKw3NMO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A8QFPmh3mXrvQ8iucH8pjSw.png" alt=""&gt;&lt;/a&gt;Déploiements&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅
&lt;/h3&gt;

&lt;p&gt;Cette configuration est assez basique mais vous pouvez bien l’adapter vous à votre workflow.&lt;/p&gt;

&lt;p&gt;Abonnez vous sur ma &lt;a href="https://www.youtube.com/channel/UC-Rak9WhKgjARd5NwyYzdlQ"&gt;chaine youtube&lt;/a&gt; ️🔔 je prépare une série de videos sur Expo.&lt;/p&gt;

&lt;p&gt;Merci ✌️&lt;/p&gt;

</description>
      <category>deployment</category>
      <category>cicd</category>
      <category>bitbucketpipelines</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>Authentification par numéro de téléphone avec Expo(SDK37) et Firebase.</title>
      <dc:creator>Mouhamed aly Sidibe</dc:creator>
      <pubDate>Mon, 13 Apr 2020 18:01:23 +0000</pubDate>
      <link>https://dev.to/expolovers/authentification-par-numero-de-telephone-avec-expo-sdk37-et-firebase-4mc9</link>
      <guid>https://dev.to/expolovers/authentification-par-numero-de-telephone-avec-expo-sdk37-et-firebase-4mc9</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4S9SzfBD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AiquPRpQs9z3E5iWSGGJA-g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4S9SzfBD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AiquPRpQs9z3E5iWSGGJA-g.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Le 31 mars 2020 &lt;strong&gt;Expo&lt;/strong&gt; a annoncé leur première release de l’année : &lt;strong&gt;LE SDK 37.&lt;/strong&gt; Dans cette nouvelle version, &lt;strong&gt;Expo&lt;/strong&gt; propose beaucoup de nouvelles fonctionnalités. Vous pouvez aller jeter un coup d’oeil &lt;a href="https://blog.expo.io/expo-sdk-37-is-now-available-dd5770f066a6"&gt;ici&lt;/a&gt; pour tout savoir sur le &lt;strong&gt;SDK 37&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Parmi les nouveautés nous avons &lt;strong&gt;l’authentification par numéro de téléphone avec Firebase.&lt;/strong&gt; Désormais &lt;strong&gt;Expo&lt;/strong&gt; nous permet d’intégrer très rapidement ce module dans notre application mobile.&lt;/p&gt;

&lt;p&gt;De nos jours cette forme d’authentification est beaucoup utilisée pour vérifier les utilisateurs rapidement et de manière sûre.&lt;/p&gt;

&lt;p&gt;Dans cet article nous allons voir étape par étape comment mettre en place ce système dans notre application expo.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prérequis
&lt;/h3&gt;

&lt;p&gt;Pour suivre ce tutoriel vous aurez besoin de:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Créer un projet expo avec le “managed workflow”. Si vous ne savez pas comment créer un projet expo vous pouvez lire &lt;a href="https://medium.com/@sidibemouhamed/les-notifications-push-avec-expo-4d30b15b486d?source=your_stories_page---------------------------"&gt;mon dernier article&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Créer un projet Firebase. Rendez vous sur &lt;a href="https://firebase.google.com/"&gt;https://firebase.google.com/&lt;/a&gt; accédez à votre console et créez un nouveau projet. Nous verrons comment créer un nouveau projet dans la section suivante.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Configuration Firebase
&lt;/h3&gt;

&lt;p&gt;Les configurations suivantes se feront dans la console Firebase.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Créer un projet Firebase
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Rendez vous dans &lt;a href="https://console.firebase.google.com/"&gt;la console Firebase&lt;/a&gt; et connectez vous à votre compte google.&lt;/li&gt;
&lt;li&gt;Cliquez sur &lt;em&gt;Add Project&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Donnez un nom à votre projet&lt;/li&gt;
&lt;li&gt;Cliquez sur &lt;em&gt;Create Project&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. Ajouter une app à votre projet Firebase
&lt;/h4&gt;

&lt;p&gt;Au niveau de la page d’accueil, cliquez sur web,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ayCLZcpz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/752/1%2A40sjowMTFDhwR_L4ANM01w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ayCLZcpz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/752/1%2A40sjowMTFDhwR_L4ANM01w.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ou bien cliquez sur &lt;em&gt;project settings&lt;/em&gt; et ensuite &lt;em&gt;add&lt;/em&gt; app&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kZkj0unZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/458/1%2AHWJKxgjZ15-kRzrx-7jcMQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kZkj0unZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/458/1%2AHWJKxgjZ15-kRzrx-7jcMQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f9pUsCNo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/952/1%2AXCuro-saMB2pwv-c2p1gCw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f9pUsCNo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/952/1%2AXCuro-saMB2pwv-c2p1gCw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choisissez un nom&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hk2g_-lI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/829/1%2Aw5zKD6lo9PE8oEatvUD6hQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hk2g_-lI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/829/1%2Aw5zKD6lo9PE8oEatvUD6hQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BP-3zLH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_Upm0ted3AmatcJ3HdHlUw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BP-3zLH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_Upm0ted3AmatcJ3HdHlUw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On va copier nos configurations et les garder quelque part on en aura besoin plus tard.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Activer l’authentification par numéro de téléphone
&lt;/h4&gt;

&lt;p&gt;Cliquez sur &lt;em&gt;Authentification&lt;/em&gt; au niveau du menu , sélectionner &lt;em&gt;phone&lt;/em&gt; puis appuyez sur le bouton activer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---3K257Wl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AO2auQut7QsfNOWz7Q3-2iA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---3K257Wl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AO2auQut7QsfNOWz7Q3-2iA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lPSIfBGj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AEFERTDstse9ABnrJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lPSIfBGj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AEFERTDstse9ABnrJ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;L’authentification par numéro de téléphone a été bien activée, nous pouvons donc l’utiliser dans notre application mobile.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Vous pouvez ajouter des numéros de test et des codes par défaut associés aux numéros pour ne pas utiliser votre quota.(voir le pricing firebase)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;C’est tout ce qu’il y a à faire coté firebase, nous pouvons maintenant nous concentrer sur notre application expo.&lt;/p&gt;

&lt;h3&gt;
  
  
  Application Expo
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Installations des dépendances:
&lt;/h4&gt;

&lt;p&gt;Nous avons besoin d’un certain nombre de dépendances pour utiliser l’authentification par numéro de téléphone, installons les:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ **expo** install [expo-firebase-recaptcha](https://docs.expo.io/versions/latest/sdk/firebase-recaptcha/) [react-native-webview](https://docs.expo.io/versions/latest/sdk/webview/) [firebase](https://docs.expo.io/versions/latest/guides/using-firebase/)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;En installant le &lt;strong&gt;expo-firebase-recaptcha&lt;/strong&gt; nous avons le composant qui va nous permettre de créer le &lt;strong&gt;Recaptcha&lt;/strong&gt; qui sert à valider si l’utilisateur est bien un humain et pas un robot.&lt;/li&gt;
&lt;li&gt;Le &lt;strong&gt;expo-firebase-recaptcha&lt;/strong&gt; s’affiche dans une webview raison pour laquelle il nous faut installer &lt;strong&gt;react-native-webview&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Et ensuite &lt;strong&gt;firebase&lt;/strong&gt; pour pouvoir utiliser les services/fonctions d’authentification par numéro de téléphone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Initialisation de firebase
&lt;/h4&gt;

&lt;p&gt;Pour utiliser firebase il faut d’abord l’initialiser. Pour ça nous allons créer un fichier &lt;strong&gt;Firebase.js&lt;/strong&gt; dans notre projet et on va y initialiser firebase avec notre configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KIG5VJqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ADrMKnNEnwGOd9NTuLJAnRQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KIG5VJqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ADrMKnNEnwGOd9NTuLJAnRQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Navigation (V5)
&lt;/h4&gt;

&lt;p&gt;Nous aurons donc deux écrans, un écran pour récupérer le numéro de téléphone de l’utilisateur, afficher le Recaptcha et ensuite envoyer le code , puis un autre écran pour vérifier le code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JUGtMuVL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0HCmGZ8ec0270TEEqvJ-zQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JUGtMuVL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0HCmGZ8ec0270TEEqvJ-zQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dans notre fichier App.js nous allons définir un simple StackNavigator qui contiendra ces deux écrans :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HQ2EY2yV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A89BcryAa43gF6x3PWHxKCQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HQ2EY2yV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A89BcryAa43gF6x3PWHxKCQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nous avons créé notre navigation et nos deux composants &lt;strong&gt;PhoneNumberScreen&lt;/strong&gt; et &lt;strong&gt;VerifyScreen.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Dans ce composant on récupère le numéro de téléphone que l’utilisateur renseigne dans le champs numéro tel et on le stocke dans le state. Nous ajoutons aussi le modal Recaptcha dans notre méthode  &lt;strong&gt;Render&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NM28tqk_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0TgGrHdTgUFOq0NXVyPxZw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NM28tqk_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0TgGrHdTgUFOq0NXVyPxZw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Quand l’utilisateur clique sur Envoyer la fonction &lt;strong&gt;sendCode()&lt;/strong&gt; s’exécute. Elle permet d’afficher le Recaptcha et d’envoyer le code par sms si tout se passe bien.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ESbYyMQf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AaSAiHJiiZ9dwAw9DrLGDeQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ESbYyMQf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AaSAiHJiiZ9dwAw9DrLGDeQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voici le code final du composant:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uQZaFPUl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Al1x87WLNn64pVzDBtUISyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uQZaFPUl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Al1x87WLNn64pVzDBtUISyw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  VerifyScreen &lt;strong&gt;.js&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Dans cet écran on doit vérifier que le code que l’utilisateur a renseigné est bien le code envoyé.&lt;/p&gt;

&lt;p&gt;Voici la fonction qui permet de faire cette vérification:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UfP6jtKW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AwgWf8gBQt0jDA0cBxdqULA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UfP6jtKW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AwgWf8gBQt0jDA0cBxdqULA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voici le code final du composant:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OOuoJF3C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Ar4esjpaq8eY9xarhazVwwQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OOuoJF3C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Ar4esjpaq8eY9xarhazVwwQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;C’est tout, nous pouvons maintenant tester notre application dans le Expo client.&lt;/p&gt;

&lt;p&gt;Voici une démo de notre application:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/media/dbbda8259f33a26390312f6d2200cf38/href"&gt;&lt;/a&gt;&lt;a href="https://medium.com/media/dbbda8259f33a26390312f6d2200cf38/href"&gt;https://medium.com/media/dbbda8259f33a26390312f6d2200cf38/href&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Quand on vérifie sur Firebase on voit bien notre utilisateur.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3Y2s7FEH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAe5n3ctr507cWKEPn8XY2A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3Y2s7FEH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAe5n3ctr507cWKEPn8XY2A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Felicitations !
&lt;/h4&gt;

&lt;p&gt;Vous pouvez retrouver les sources du projet &lt;a href="https://github.com/Sidibedev/ExpoPhoneAuthentification"&gt;ici&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;J’ai découvert un outil très cool qui s’appelle &lt;a href="http://doorman.cool"&gt;&lt;strong&gt;doorman&lt;/strong&gt;&lt;/a&gt; et permet d’intégrer l’authentification par numéro de téléphone très facilement sans avoir à beaucoup coder. Ils fournissent un backend et un UI complet. J’écrirais un article sur cet outil bientôt.&lt;/p&gt;

&lt;p&gt;N’hésitez pas à utiliser l’authentification par numéro dans vos applications.C’est l’un des meilleurs moyens de vérifier vos utilisateurs et d’être sûr que c’est pas des robots grâce au Recaptcha. En termes de &lt;strong&gt;UX&lt;/strong&gt; c’est généralement mieux qu’un système de email/mot de passe.&lt;/p&gt;

&lt;p&gt;Merci et à bientôt.&lt;/p&gt;

</description>
      <category>phonenumber</category>
      <category>reactnative</category>
      <category>firebase</category>
      <category>expo</category>
    </item>
    <item>
      <title>Les notifications push avec Expo.</title>
      <dc:creator>Mouhamed aly Sidibe</dc:creator>
      <pubDate>Mon, 06 Apr 2020 19:48:04 +0000</pubDate>
      <link>https://dev.to/expolovers/les-notifications-push-avec-expo-4c22</link>
      <guid>https://dev.to/expolovers/les-notifications-push-avec-expo-4c22</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PfLu-nQQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/750/1%2AkhfEdToqjvxURcCqSQetRg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PfLu-nQQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/750/1%2AkhfEdToqjvxURcCqSQetRg.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Les &lt;strong&gt;Notifications Push&lt;/strong&gt; sont les messages qui apparaissent sur l’écran de votre smartphone lorsque vous n’utilisez pas l’application.C’un bon moyen de rappeler l’existence de votre application à vos utilisateurs. Lorsqu’elles ne sont pas trop intrusives et restent utiles pour l’utilisateur, elles permettent d’augmenter très rapidement le taux de rétention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Expo&lt;/strong&gt; nous permet d’intégrer très facilement les notifications push dans notre application react native. Nous allons voir pas à pas comment envoyer des notifications à nos utilisateurs depuis notre application expo.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Installer le expo-cli
&lt;/h3&gt;

&lt;p&gt;Expo vous procure un outil en ligne de commande qui vous permet de gagner en productivité. Vous devez l’installer globalement sur votre machine comme suit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm install -g expo-cli
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Créer le projet
&lt;/h3&gt;

&lt;p&gt;Une fois le expo-cli installé, vous pouvez maintenant l’utiliser pour créer votre projet. Vous pouvez choisir un template pour aller plus vite mais dans notre cas on va juste choisir le blank template.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ expo init ExpoPushNotifications
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Expo va installer toutes les dépendances nécessaires pour votre app.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Exécuter le projet
&lt;/h3&gt;

&lt;p&gt;Vous pouvez vous déplacer vers le dossier de votre projet et exécuter votre projet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ExpoPushNotifications &amp;amp;&amp;amp; expo start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Ou bien&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ExpoPushNotifications &amp;amp;&amp;amp; yarn start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Si tout se passe bien vous aurez quelque chose qui ressemble à ça:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WIy_G93h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/890/1%2Ay2Ncyk2CkPvUgqdPC-uS0Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WIy_G93h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/890/1%2Ay2Ncyk2CkPvUgqdPC-uS0Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Tester l’application
&lt;/h3&gt;

&lt;p&gt;Maintenant que vous avez exécuté votre projet, vous avez besoin d’avoir un rendu de votre application. Pour ça il faut télécharger le Expo client sur P&lt;a href="https://play.google.com/store/apps/details?id=host.exp.exponent&amp;amp;referrer=www"&gt;lay store o&lt;/a&gt;u A&lt;a href="https://apps.apple.com/app/apple-store/id982107779"&gt;pp Store.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B7hkkzH_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AO0gi8HJkCyY0kZYtwljFig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B7hkkzH_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AO0gi8HJkCyY0kZYtwljFig.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Une fois l’application téléchargée, connectez vous sur le même réseau que votre ordinateur et vous verrez votre projet ExpoPushNotifications dans l’application expo client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7o7tv-6h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/209/1%2A0Dtbvcda-O-AIB15BYrqUQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7o7tv-6h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/209/1%2A0Dtbvcda-O-AIB15BYrqUQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vous pouvez cliquer sur le projet pour l’ouvrir, normalement vous aurez un écran qui ressemble à ça:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GRWmHFp---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/214/1%2ABdnFsjUSyYLGR5yNscyKtg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GRWmHFp---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/214/1%2ABdnFsjUSyYLGR5yNscyKtg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Votre application est prête. Vous pouvez effectuer des changements au niveau du App.js et voir directement le résultat dans l’application.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Obtention du Expo Push Token
&lt;/h3&gt;

&lt;p&gt;Expo a besoin de savoir à quel appareil il doit envoyer la notification. Le Expo Push token sert à identifier chaque appareil. Ce token est unique et généré à chaque fois que votre application est installé sur un smartphone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UAjEl-QZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/801/1%2AbpYB6TR637uEp6dgLmp8qg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UAjEl-QZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/801/1%2AbpYB6TR637uEp6dgLmp8qg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vous pouvez donc récupérer ce token, le lié à un utilisateur et le stocker sur votre serveur.&lt;/p&gt;

&lt;h4&gt;
  
  
  En pratique
&lt;/h4&gt;

&lt;p&gt;La première chose à faire c’est d’importer &lt;strong&gt;Notification&lt;/strong&gt; et &lt;strong&gt;expo-permissions&lt;/strong&gt; pour pouvoir utiliser les services de notifications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Notifications } from ‘expo’;

import \* as Permissions from ‘expo-permissions’;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Nous allons maintenant écrire une fonction qui va nous permettre de demander la permission d’envoyer des notifications, si on nous l’accorde on peut récupérer le Expo push token.&lt;/p&gt;

&lt;p&gt;Voici notre classe:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fQymP0ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AE5HGCZLMh-L8aKbyrMFqoA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fQymP0ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AE5HGCZLMh-L8aKbyrMFqoA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nous avons notre Expo push token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**ExponentPushToken[UwO2W\_L5ryJt1Cji5Ta8Qy]**
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Envoi de la notification
&lt;/h3&gt;

&lt;p&gt;Nous avons récupérer le Expo push token, il nous reste qu’à envoyer la notification à cet appareil en question. Normalement une notification vient d’un serveur. Expo fournit une &lt;strong&gt;API RES&lt;/strong&gt; T que vous vous pouvez appeler depuis votre backend en lui passant juste le Expo push token.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i4gEmS3b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/858/1%2A6hKzAdWXzNWLK2P8s_MXRw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i4gEmS3b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/858/1%2A6hKzAdWXzNWLK2P8s_MXRw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ce qui est cool encore c’est qu’il y a des packages déjà codés que vous pouvez utiliser coté backend en fonction du langage que vous utilisez: PHP , JAVA, PYTHON etc, vous pouvez trouver la liste complète &lt;a href="https://docs.expo.io/versions/v37.0.0/guides/push-notifications/"&gt;ici&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Mais dans cet article nous allons utiliser le &lt;a href="https://expo.io/notifications"&gt;Expo push notification Tool&lt;/a&gt; pour envoyer nos notifications facilement sans coder.&lt;/p&gt;

&lt;p&gt;C’est une app développée par expo qui permet d’envoyer des notifications push en renseignant le Expo push token , les données que vous voulez envoyer et d’autres paramètres facultatifs:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3i-Xik6t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AXPHBnqXisS0X9-vJI6Qxig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3i-Xik6t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AXPHBnqXisS0X9-vJI6Qxig.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;L’appareil qui possède le expo push token qu’on a renseigné va recevoir la notification:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xq6R2UMz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/219/1%2A7FM82pNOLsnCIx9vdCZpRw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xq6R2UMz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/219/1%2A7FM82pNOLsnCIx9vdCZpRw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Affichage des données de la notification dans notre app
&lt;/h3&gt;

&lt;p&gt;Nous arrivons à envoyer la notification, ce qu’on veut maintenant c’est afficher les données qu’on envoie dans notre application.&lt;/p&gt;

&lt;p&gt;Nous allons envoyer une nouvelle notification, mais cette fois ci avec des données: {“name”: “mas”}.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J4Gb1pwl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/838/1%2Anod-GQh3uLDUO6eBy0S5gQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J4Gb1pwl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/838/1%2Anod-GQh3uLDUO6eBy0S5gQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pour afficher les données dans notre app il nous faut faire une souscription qui permet à chaque fois qu’on recevra une notification de faire un traitement spécifique:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---JULa0sc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Avs7tkRcaui_iq0OyhP0jNw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---JULa0sc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Avs7tkRcaui_iq0OyhP0jNw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voici notre fonction _HandleNotification() qui s’exécute chaque fois qu’on recevra une notification:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a7hq64a_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAYDDyhpY3CZjEB7gDAqnng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a7hq64a_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAYDDyhpY3CZjEB7gDAqnng.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cette fonction reçoit l’objet notification qui contient nos données et le stocke dans le state.&lt;/p&gt;

&lt;p&gt;Ainsi nous pouvons afficher les données reçu dans le render:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oBP_QSVI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0GYOYGNuZKdXsm8JJjD9Dw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oBP_QSVI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0GYOYGNuZKdXsm8JJjD9Dw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Et Dans l’application on voit bien les données envoyées:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FC5w1mq_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/206/1%2A7qLRlu0DN0bPNg_pxMKGLw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FC5w1mq_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/206/1%2A7qLRlu0DN0bPNg_pxMKGLw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On peut après utiliser ces données pour en faire ce qu’on veut. COOL !!&lt;/p&gt;

&lt;p&gt;J’espère que cet article vous a aider à comprendre comment fonctionnent les notifications push avec Expo et vous encourage à utiliser Expo pour vos applications React native.&lt;/p&gt;

&lt;p&gt;Merci.&lt;/p&gt;

</description>
      <category>notifications</category>
      <category>reactnative</category>
      <category>expo</category>
    </item>
  </channel>
</rss>
