React Progressive Web Apps — Part 1 – Progressive Web Apps – Medium

#ReactJS Progressive #Web Apps:  by @GethylK #JavaScript

  • How to create your first PWA app and/or convert your existing app into PWA.In this example I created new React app with PWA in mind, but the idea should be quite similar if you have to convert your existing app into PWA.You need to understand the lifecycle of a SW, which…
  • Here is the code snippet from index.htmlRegister SW if browser supportsIf the above registration step was successful, then the SW file will be downloaded.
  • Well that is because SW can intercept the fetch event, and this will help if you want to cache something from the network.Updating Cache / Making network calls — Fetch eventSW listens to fetch event, and in our example since we handle only the basic case of caching only the static files,…
  • Adding your app to the Home Screen.Perfect!Step 1 above showed you the importance of SW and how it helps to make your app to be offline first.Step 2, tells you how you can run it from your virtual device.And now let us make it feel a bit more like an app,…
  • I would highly recommend you to use it to generate a report of you webpage.Here is an example of this github example.Webpack run on dev mode yarn startWebpack dev server with prod build yarn start:PRODWhen I first ran the report, the scores where much worse, and I went through the suggestions…

Progressive Web Apps(PWA) are gaining a lot of popularity these day, and with one of the updates this year (2017), the Create React App creates your project by default as PWA. If you haven’t heard of…
Continue reading “React Progressive Web Apps — Part 1 – Progressive Web Apps – Medium”

How to Draw an Owl with React: A Migration Story

Do you know the four P’s of migrating to React? Learn 'em now:  #reactjs cc: @ReactJS_News

  • A few months ago, I wrote about our adventures building a brand new project using React.
  • Our existing SparkPost app was built many moons ago in the ancient framework known as AngularJS.
  • Shortly after that article was published, I started in on my plan to improve the Angular app.
  • Ultimately we realized that the fastest and safest way to rebuild our entire app in a brand new framework was to do exactly what I’d publicly ridiculed: direct migration, i.e. a parallel rebuild.
  • Step 2: Draw the rest of the [censored] owl.

Sometimes even the best-laid plans need to be re-laid. A walk through on how (and why) we’re migrating our Angular app directly to React.
Continue reading “How to Draw an Owl with React: A Migration Story”

How to learn React Native

  • React Native is the hot topic these days for building mobile apps.
  • Learning ES6 makes it much easier to write React and React Native code.
  • The main things you should have learnt after completing the tutorial are Lifecycle of a React Component and what are props and state – – React Native uses Flexbox layout style to render views in a much easier and responsive way.
  • Since an important function in mobile app is how to navigate between screens, it is important to know how it’s done in React Native.
  • As of this writing, RN recommends to use libraries like ReactNavigation and React Native Navigation to use same code for both Android and iOS.

Here is a small guide for Android/iOS developers on how to learn React Native.
Continue reading “How to learn React Native”

How to do end-to-end testing on React Native with Detox

  • They are being performed on matched elements.Expect verifies if a certain value is as expected to be.As we can see detox covers a lot of possible user interactions that can be automated.Make our tests more readableTo be honest, we can do much better.First let’s get rid of the duplication for matchers…
  • Automate the process and land on the moon 🚀Once we reached a certain amount of tests, we thought it could be nice to automate the process and think in terms of “continuous testing”.
  • That’s why we decided to run the end-to-end test on our build server.Every new pull request that comes in, triggers unit tests with Jest on CircleCI and now also our end-to-end tests on Bitrise (our build server).
  • This is mostly due to the Detox build scripts.AlternativesWe also considered others libraries such as:Appium which is a cross platform test library where tests can be written in many languages (node, ruby, java, … ).
  • Hence, our choice of using Detox.ConclusionIn this article we saw how to handle Detox and its API, how to automate everything with Bitrise (or any CI that can runs an IOS Simulator).

When we started writing our React-Native app at Home, testing was something we took seriously from day one. While it was easy to setup a proper unit-tests workflow with Jest and Typescript, we figure…
Continue reading “How to do end-to-end testing on React Native with Detox”

MongoDB, React, and Node.js tutorial for Azure

🌌 Create a #MongoDB app with @reactjs and #AzureCosmosDB

  • The app used Node and Express for the server, connects to Azure Cosmos DB with the MongoDB API, and then connects the React front-end to the server portion of the app.
  • The tutorial also demonstrates how to do point-and-click scaling of Azure Cosmos DB in the Azure portal and how to deploy the app to the internet so everyone can track their favorite heroes.
  • Azure Cosmos DB supports MongoDB client connections, so you can use Azure Cosmos DB in place of MongoDB, but use the same code that you use for MongoDB apps; but with added benefits such as simple cloud deployment, scaling, and super-fast reads and writes.
  • In this video, Burke Holland gives an introduction to Azure Cosmos DB and walks you through the app that is created in this video series.
  • This video shows how to create an Azure Cosmos DB account in the Azure portal, install the MongoDB and Mongoose packages, and then connect the app to the newly created account using the Azure Cosmos DB connection string.

Learn how to create a MongoDB app with React and Node.js on Azure Cosmos DB using the exact same APIs you use for MongoDB with this video based tutorial series.
Continue reading “MongoDB, React, and Node.js tutorial for Azure”

Expo SDK 21.0.0 is now available – Exposition

  • We do recommend updating sooner rather than later — see this commit from our template projects for an example of how to update.When developing, using the new API lets us show an error screen if an error is hit during the first render of your app, instead of hanging or restarting:Note that…
  • This should make it significantly easier to tell the difference between an error loading your app and a slow network connection.If you are experiencing slow loading times when developing your app, check to see if you have the “tunnel” mode enabled in XDE/exp and try using LAN connections if your…
  • There is an example in the Native Component List, and Brent has also published a couple of example projects using the new API:We do have a documentation page for this API, although for the time being it just points to the GitHub repository.Google AdMobSDK 21 now supports displaying ads through…
  • To help your App Review process go more smoothly, we’ve decided to remove the Stripe SDK and experimental Payments API from apps built with the Expo standalone builder.
  • This was a problem with a dependency we used for detecting the machine IP address, and has been fixed.Upgrading Your AppHere’s how to upgrade your app to Expo SDK 21.0.0 from 20.0.0:Close XDE or your exp CLI serverIn app.json, change sdkVersion to “21.0.0”In package.json, change these dependencies:- react-native to expo to…

I am happy to announce the release of Expo SDK 21.0.0! It is based on React Native 0.48 “August”. Our previous SDK, 20.0.0, is based on React Native 0.47 “July”. AppLoading has been extended with new…
Continue reading “Expo SDK 21.0.0 is now available – Exposition”

React Progressive Web Apps — Part 1 – Progressive Web Apps – Medium

#ReactJS Progressive #Web Apps:  by @GethylK #JavaScript

  • How to create your first PWA app and/or convert your existing app into PWA.In this example I created new React app with PWA in mind, but the idea should be quite similar if you have to convert your existing app into PWA.You need to understand the lifecycle of a SW, which are listed below, and you can read more about it in this link.Register the Service Worker(SW)If a browser supports SW, then the service worker will be registered.
  • Here is the code snippet from index.htmlRegister SW if browser supportsIf the above registration step was successful, then the SW file will be downloaded.
  • Well that is because SW can intercept the fetch event, and this will help if you want to cache something from the network.Updating Cache / Making network calls — Fetch eventSW listens to fetch event, and in our example since we handle only the basic case of caching only the static files, you can see below, when there is a fetch event within the SW’s scope (Refer the registration step to see the scope),it is intercepted, and we checked if request has a response already in the cache, then we return the response from cache.
  • Adding your app to the Home Screen.Perfect!Step 1 above showed you the importance of SW and how it helps to make your app to be offline first.Step 2, tells you how you can run it from your virtual device.And now let us make it feel a bit more like an app, but letting you add this to your homepage, so that you can launch it anytime later without the need to remember the url or bookmark it.This is where you need to under about web manifest json file, which was one of the topic I mentioned would be good to know.
  • I would highly recommend you to use it to generate a report of you webpage.Here is an example of this github example.Webpack run on dev mode yarn startWebpack dev server with prod build yarn start:PRODWhen I first ran the report, the scores where much worse, and I went through the suggestions provided against the areas the app scored bad and did some fine tuning.

Progressive Web Apps(PWA) are gaining a lot of popularity these day, and with one of the updates this year (2017), the Create React App creates your project by default as PWA. If you haven’t heard of…
Continue reading “React Progressive Web Apps — Part 1 – Progressive Web Apps – Medium”