Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

☞ 

#Nodejs

  • for me i start at 20$/month is good start and then we can upgrade.Choose a datacenter region: DigitalOcean has many datacenters that mean you can pick one for your project if your visitors almost from NY United States let select New York, so example if i target all visitors from…
  • Your cloud vps is ready to use.Check your email address that you did register in DigitalOcean you shold get an email notify about your VPS IP, root account and password.
  • in this project we need open port 80 for http access, 443 https (ssl) , and port 22 (for ssh login) that is enough.By default Firewall is inactive, you can check it by run command sudo ufw statussudo ufw app listSo let config FW allow those ports bysudo ufw allow ‘Nginx…
  • So Node.js is requiredvisit to see the documentationWe use package management to install, here is command to install Node.js v9curl -sL | sudo -E bash -sudo apt-get install -y nodejsAfter successful Node.js installed we can check the version by typing in command line : node -v and you see see “v9.3.0″Setup…
  • we can change the port to 3001 or 3002, or 8080 … so if you pointed your domain tabvn.com to Degital Ocean cloud vps so this case we can visit the chat app in http://tabvn.com:3000 so we need just see nodejs web app in default port 80 such at http://tabvn.com , that…

I have been using DigitalOcean for me and setup for my customers, so recommend use it for your project just pick vps depend on how big of your project start at 5$ or 10$, 20$, price very flexibility…
Continue reading “Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting”

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

☞ 

#Nodejs

  • for me i start at 20$/month is good start and then we can upgrade.Choose a datacenter region: DigitalOcean has many datacenters that mean you can pick one for your project if your visitors almost from NY United States let select New York, so example if i target all visitors from…
  • Your cloud vps is ready to use.Check your email address that you did register in DigitalOcean you shold get an email notify about your VPS IP, root account and password.
  • in this project we need open port 80 for http access, 443 https (ssl) , and port 22 (for ssh login) that is enough.By default Firewall is inactive, you can check it by run command sudo ufw statussudo ufw app listSo let config FW allow those ports bysudo ufw allow ‘Nginx…
  • So Node.js is requiredvisit to see the documentationWe use package management to install, here is command to install Node.js v9curl -sL | sudo -E bash -sudo apt-get install -y nodejsAfter successful Node.js installed we can check the version by typing in command line : node -v and you see see “v9.3.0″Setup…
  • we can change the port to 3001 or 3002, or 8080 … so if you pointed your domain tabvn.com to Degital Ocean cloud vps so this case we can visit the chat app in http://tabvn.com:3000 so we need just see nodejs web app in default port 80 such at http://tabvn.com , that…

I have been using DigitalOcean for me and setup for my customers, so recommend use it for your project just pick vps depend on how big of your project start at 5$ or 10$, 20$, price very flexibility…
Continue reading “Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting”

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

☞ 

#Nodejs

  • for me i start at 20$/month is good start and then we can upgrade.Choose a datacenter region: DigitalOcean has many datacenters that mean you can pick one for your project if your visitors almost from NY United States let select New York, so example if i target all visitors from…
  • Your cloud vps is ready to use.Check your email address that you did register in DigitalOcean you shold get an email notify about your VPS IP, root account and password.
  • in this project we need open port 80 for http access, 443 https (ssl) , and port 22 (for ssh login) that is enough.By default Firewall is inactive, you can check it by run command sudo ufw statussudo ufw app listSo let config FW allow those ports bysudo ufw allow ‘Nginx…
  • So Node.js is requiredvisit to see the documentationWe use package management to install, here is command to install Node.js v9curl -sL | sudo -E bash -sudo apt-get install -y nodejsAfter successful Node.js installed we can check the version by typing in command line : node -v and you see see “v9.3.0″Setup…
  • we can change the port to 3001 or 3002, or 8080 … so if you pointed your domain tabvn.com to Degital Ocean cloud vps so this case we can visit the chat app in http://tabvn.com:3000 so we need just see nodejs web app in default port 80 such at http://tabvn.com , that…

I have been using DigitalOcean for me and setup for my customers, so recommend use it for your project just pick vps depend on how big of your project start at 5$ or 10$, 20$, price very flexibility…
Continue reading “Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting”

Horizontal scroll animations in React Native – codeburst

  • Horizontal scroll animations in React NativeLink Animated with ScrollView to create a nice navigation UI animation in React NativeWhat we will be buildingRN lets you build a nice and smooth UIWhat you will needReact NativeSimulatorNo third party libraries required :)Creating Screen component with AnimatedFirst, import Animated, Dimensions, ScrollView, StyleSheet, Text, View from “react-native” .
  • Next, create a component that will be treated as a screen or a view.We are using Animated.View here because we are going to animate that wrapper component.That width ofscrollPage style and are important because we are going to interpolate horizontal scrolling values to multiple animation values.
  • In other words, we are going to track where the screen is and animate the screen component based on that value.It’s one of the things that are tricky to explain in words, but it is the key concept to understand for this to work.Basically, we link animations based on the…
  • When the scroll position is at 150, first screen is half way done exiting, and the second screen is half way done entering.Adding animationsSince they are all set up, it is time to write the animations.
  • You would have to write a different inputRange since FlatList removes items that scroll way off screen.I think this is pretty neat UI animation that’s pretty simple to use.

That width ofscrollPage style and transitionAnimation(props.index) are important because we are going to interpolate horizontal scrolling values to multiple animation values. In other words, we are…
Continue reading “Horizontal scroll animations in React Native – codeburst”

React Native: Handling language changes on Android the right way

  • React Native: Handling language changes on Android the right wayOne of the core features of your app is internationalization (aka I18n), right?
  • Internationalization is all about offering your products in such a way that they can be localized for languages and cultures easily.In react native there is a very nice library to handle it: With this library, you can define a list of locales your mobile app supports:I18n.fallbacks = true;I18n.translations = { en, es, pl, fr, it,};Note: Fallback is important for unfinished translations.
  • So if your fallback language is en and you have a key that is not translated (so not defined in another language) it will use the key from the fallback language instead.Using the module is also pretty familiar if you come from the web:I18n.t(‘some_key’)One of the lovely things to handle this on the JavaScript side (I developed pure Android apps) is that you can update your .
  • I found out that when using this library on Android, if we change the system language, the app will not update to the new locale till I reload the JS bundle.
  • That is not the Android default behavior so… Let’s fix it!Solving the reload Android problemLet’s see first what happens on iOS when changing the system language and going back to our app:I speeded up the video a bit…As you can see, everything works as expected, our app and bundle gets restarted when coming back to it and we see the new language in place.

One of the core features of your app is internationalization (aka I18n), right? Internationalization is all about offering your products in such a way that they can be localized for languages and…
Continue reading “React Native: Handling language changes on Android the right way”

Topcoder Getting Started with ReactJS

Getting Started with ReactJS - A blog that is supplemented by a Fun Challenge!

  • ReactJS uses JSX to transpire the HTML element on the web page.
  • React first converts JSX into a JavaScript file that is rendered by the browser, resulting in HTML code.
  • BABEL converts JSX code in JavaScript and takes care of cross-browser compatibility.
  • ReactJS functions are called components.
  • ReactJS gives us power to pass data between components and we do it using props and states.

Have you ever thought of passing your HTML code into JavaScript code? How about displaying HTML elements via JavaScript?
Continue reading “Topcoder Getting Started with ReactJS”

Organizing Large Redux Projects – Collaborne Engineering – Medium

Organizing large #Redux projects:  #ReactJS

  • Now, data handling is no longer buried deep in the UI component files but split out in separated files for action types, reducers, actions, and selectors.Organize by featureInitially we kept the Redux files alongside the UI components, which we organize by feature area (e.g. users-related functionality is in users/ action-types.
  • But the structure has also two major flaws:Redux related functionality is not grouped: The Redux code has to interact across features, e.g. a group has members, which are modeled as users.Data management for UI and for data model is mixed up: The users reducer manages a lookup table byId (i.e. access to the real data) as well as the ID of the currently viewed user.
  • html), which itself only holds the IDs of the members.Match UI components, Redux code, and state shapeTo addressed these two issues, we re-organized the code by UI components vs. Redux and then by data vs. UI:components/ users/ user-ui.
  • html actions.html reducers.html selectors.html reducers.html ui/ users/ action-types.
  • This allows to easily compose the reducers, e.g. the UI reducer brings together the reducers for the users and groups UI:uiReducer = Redux.combineReducers({ users: uiUsersReducer, groups: uiGroupsReducer});Happy coding!Want to learn more about Polymer?

Since we moved to Redux, our data management is finally properly split from our UI components. Now, data handling is no longer buried deep in the UI component files but split out in separated files…
Continue reading “Organizing Large Redux Projects – Collaborne Engineering – Medium”

7 tips of using MobX – Huiseoul Engineering

7 tips of using MobX  #javascript #react #mobx #reactjs

  • These are the very basic building blocks of MobX:observable: is the data that you are expecting to changeobserver: is a component that you want to be re-rendered depending on the observable datacomputed values: are functions returning values based on calculation of observable valuesreactions: many different types of functions that can be executed based on observable values2.
  • In large applications this might cause confusion and make it hard to track down where the data are being changed.Strict mode will give you peace of mindSo MobX provides a strict mode where you can only change your data inside of functions marked as actions can change observable values.In strict mode, only action functions can change observable values5.
  • MobX document suggests:one store for app-wide UImultiple stores for each domainStore states in storesIt means that you might want to have UiStore or AppStore for your app-wide, UI data, and other domain stores for each of your domain like UserStore, ProductStore, BrandStore, etc.7.
  • Having MobX, and introducing new concepts and using separated stores might get your app overly-complicated otherwise simple react components talking to each other.So if you start from scratch you might try to solve the problem of state management without MobX first then start to use it if you see the clear benefit for all of your colleagues.Even after introducing MobX in your app, consider using local states for simple view-only states like isLoading or isDisabled.
  • It might be better solution than MobX if you are working with explicitly time-based data among other situations.Redux is a predictable state container for JavaScript appsHappy coding!

MobX is a convenient tool that you can use in React projects to manage states across components. Here are 7 tips we have learned along the way we have built our app at Huiseoul using MobX for our…
Continue reading “7 tips of using MobX – Huiseoul Engineering”

Why props are your friend!

Why props are your friend! => 

{ Story by @RockChalkDev }

🍻 #ReactJS #JavaScript

  • The way this works is that when the user comes to the Home page they are greeted with four images that represent their respective collection.
  • When the user selects one of the four images on the Home page an async method, , is called.
  • This function is responsible for two things:

    When the user gets to the Portfolio page they are greeted with a Carousel displaying the images.

  • The Porfolio component is connected to the Redux store so it has access to the app state in our case we want .
  • Below you an see what looks like on a user’s selection:

    The Redux store doesn’t have that information avaliable in state.

This the first time I’ve ever done a blog post, I guess this is a blog post. I wanted to share this because I’m pretty impressed with my use of props &.
Continue reading “Why props are your friend!”

React Native and Native Modules: The Android SyncAdapter

  • React Native and Native Modules: The Android SyncAdapterReact Native and Android have been friends for a whileI came into the need of using a SyncAdapter for an Android app I want to fully convert into React Native.
  • For this native module that I named as react-native-sync-background, we are gonna combine the Android SyncAdapter with the HeadlessJS.
  • In there, we want to start our HeadlessJS so we can write all the actual sync code in JavaScript (like fetching from an API):Our HeadlessService.class is almost the same as the one explained on the docs but with some extra checks:There are several things worth mentioning here:new HeadlessJsTaskConfig( TASK_ID, null, 300000);We hardcoded our TASK_ID to be TASK_SYNC_BACKGROUND so you will need to register a task with this exact same name and that is the task our SyncAdapter will runWe pass null as parameter so the actual JS task will receive null as extra (since we do not need any param)Default timeout is set to 5 minutes which should be enough for any task of this kind.
  • If we actually return just null, it will start a non-sticky Service that will not be stopped (which is bad for memory/battery) so we make sure that we handle this edge case.Creating the moduleLet’s go ahead and create a native module, named SyncBackground that will be responsible for interacting with our SyncAdapter:Basically we do two things here:Override getName so from now on, our Native Module will be called SyncBackgroundExpose (using @ReactMethod), in this case, just the method init that will set up all the sync hassle for usNow, loading that module is just a matter of adding a new instance of it to the native modules list, as shown below:So the apps that want to actually use this module will be able to add new SyncBackgroundPackage() just as we do in the example app.More on the native side, we want our module to act as an Android library so we can use it in other projects, to do so, take a look at the build.gradle file.
  • To your question: Yes, I AM A WIZARD.By the way, notice at the second screenshot, you can select the option Sync Now which will trigger onPerformSync which will trigger your HeadlessJS task so you can try it out without waiting at all.Exposing a typed APII find it nice not to expose the Native Module as it is, but wrap it into your own API where you can actually use some typing (Hello Flow!)

I came into the need of using a SyncAdapter for an Android app I want to fully convert into React Native. In this app, I already have the native piece of code working and I could not find a library…
Continue reading “React Native and Native Modules: The Android SyncAdapter”