Manage React Native Data with Redux

Getting Started

Create a new Expo managed TypeScript blank project if you don’t have an existing project you are working with (replace ‘todo’ with what you want to name your project):

expo init todo

To start using Redux, you’ll have to install the Redux and React Redux packages:

npm install --save redux react-redux
npm install --save-dev @types/react-redux

Also, if you want to follow along with this tutorial, you can install react-navigation:

Initializing the Store

  1. In the App.tsx file, create a new store instance and wrap your app in the <Provider/> tag:

Tips for how to be more efficient with Storybook and Angular

Photo by Jefferson Santos on Unsplash

Prerequisites:

  • Angular project setup
  • Storybook installed (checkout my setup article)

Below is an example of how I format my .stories.ts files:

As you can see, I import the TodoModule instead of declaring TodoComponent and then importing it’s dependencies. This makes the stories a lot more maintainable since you don’t have to go back and update them whenever you change the imports in your module.

I know some developers don’t create modules for each component, but I found that it makes the components a lot more portable since they aren’t coupled to the parent component module (ex. AppModule). …


Learn the truth about the benefits of exercise

From Tyler Nix on Unsplash

The Truth

Exercise itself doesn’t burn fat like people think. Running on the treadmill for 2 hours can be good for your cardiovascular health, but it may do little to burn fat according to new research.

Research has found that the muscle gained from exercise is what really burns fat. So the process flows like so:

EXERCISE => MUSCLE => FAT BURN 🔥

Knowing this, what can you do to burn fat?

Solution

Build muscle! Of course check with your doctor first, but exercise that target muscle strengthening and building will help improve overall metabolism that will in the end lead to increased…


Recent Study Suggests Fasting May Have Limited Fat Loss Effect.

Should you follow this way of eating for overall health?

Photo by Brooke Lark on Unsplash

Intermittent fasting has been a major diet fad in the past couple of years. Large proponents such as Dr. Peter Attia have promoted the benefits of intermittent fasting through his podcast and an app he created called Zero.

A recent experiment has recently emerged stating that the fat loss effects of intermittent fasting are similar to that of other diets. Experts seeing these new studies are recommending people either steer away from intermittent fasting. Is the data found in the study accurate? What does it mean for you?

I would propose that since intermittent fasting has more benefits than fat…


Publish Your First iOS App

Photo by Yura Fresh on Unsplash

Now that you have created your amazing React Native app, let’s deploy it to the Apple App Store so others can download it!

Prerequisites

  • Expo React Native app created
  • Splash screen and app icon created (project/assets folder)
  • Transporter app installed on Mac
  • XCode installed

Building and Publishing

Expo makes it very easy to build and deploy your app to the App Store.

  1. In your project folder, with a terminal window, run the following: expo build:ios
  2. Follow the prompts in the command line using your arrow keys and the ENTER button
  3. When the build finishes, navigate to…

Data Driven React Native Apps

Let’s create a simple app screen with a list populate through an HTTP request using fetch.

Photo by Tudor Baciu on Unsplash

Making HTTP requests from React Native is pretty easy given the built in fetch API.

Below are the steps you can follow to make an API request and populate a list:

  1. In the component you want to load data for, add a useEffect block that calls your API (modify the Todo type to your data model)
const [todos, setTodos] = useState<Todo[]>([]);
useEffect(() => { fetch('http://localhost:8080/api/todo') .then((res: Response): Promise<Todo[]> => res.json()) .then((todos: Todo[]) => setTodos(todos)) .catch((error) => console.error('Error loading todos', error));}, []);

2. Add…


Fully Native App With JavaScript

Photo by Ferenc Almasi on Unsplash

This article is going to cover how to create a basic a React Native app with routing. I will be using a Mac computer, but the instructions should be similar for Windows / Linux machines.

Prerequisites

  • Preferred TypeScript experience
  • Some React experience

Getting Started

  1. With a terminal window in your workspace directory, run the command expo init todo. At the prompt, you can choose the project style you feel most comfortable with. For this tutorial, I will be using a ‘Managed’, ‘blank (TypeScript)’ template. …

Don’t let your app get sluggish, handle your subscriptions

Handling Angular Subscriptions Properly
Handling Angular Subscriptions Properly
Photo by Kevin Ku on Unsplash

Bad Way of Handling Subscriptions

In my early Angular days, I would subscribe to observables without unsubscribing before the app was destroyed, possibly leading to a build up of memory leaks. For example:

Better Way

A simple way to avoid this is to save a reference to the subscription and unsubscribe in the ngOnDestroy lifecycle method. For example:

This is better, but what if you have a bunch of subscriptions in your component? There’s a nifty rxjs operator you can use for that.

You can create a subject, ngDestroy$ and pipe each subscription with the…


How to Evaluate Stocks for Potential

Photo by Micheile Henderson on Unsplash

Overview

I’m going to be honest with you upfront. Starting off in the stock market is overwhelming and will lead to you losing money at some point. Over 90% of day traders lose money. The amount of money you lose and how you handle it will determine your overall success in the long run.

One of the most effective strategies to staying in the green is to cut losses quickly and not “bag hold” stocks with the hope they will eventually go up. Identifying stocks that have a large ( > 5%) margin of profit and a possible loss of lower…


Break into the Big Four!

Amazon app on phone
Amazon app on phone
Photo by Christian Wiediger on Unsplash

I took the Amazon interview about 2 months ago, prepping for about one week. The interview itself wasn’t as bad as I expected, but I’m still glad I prepared.

Interview Sections (Onsite)

  • OOO design question
  • Systems design (usually one question)
  • Behavioral questions (leadership principles)

Leadership Principles

Make sure you are familiar with the leadership principles and that you can provide real examples from your past professional experiences for each of them. You will probably be asked for examples for most of them. Make sure you also have backup examples in case the interviewer wants to go into more depth.

The most important…

Jake Cyr

I am a SDE at Amazon, developing full-stack applications. I have interests in health and finance and enjoy learning new things daily!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store