Learning React.js: Getting Started and Concepts ― Scotch

  • — React Code Goes Here — – – /script – /body – /html – In React, components mount to an element, so in this example we can use the div myDiv as it’s parent container.
  • These attributes are available in our component as this.props and can be used in our render method to render dynamic data: – var MyComponent = React.createClass({ – render: function(){ – return ( – h1Hello, {this.props.name}!
  • Below, see how we can set our component’s state: – var MyComponent = React.createClass({ – getInitialState: function(){ – return { – count: 5 – } – }, – render: function(){ – return ( – h1{this.state.count}/h1 – ) – } – }); – – Events – React also has a built…
  • Lets make our count increment below using events: – /** @jsx React.DOM */ – – var Counter = React.createClass({ – incrementCount: function(){ – this.setState({ – count: this.state.count + 1 – }); – }, – getInitialState: function(){ – return { – count: 0 – } – }, – render: function(){ -…
  • == -1; – }); – this.setState({items: updatedList}); – }, – getInitialState: function(){ – return { – initialItems: [ – “Apples”, – “Broccoli”, – “Chicken”, – “Duck”, – “Eggs”, – “Fish”, – “Granola”, – “Hash Browns” – ], – items: [] – } – }, – componentWillMount: function(){ – this.setState({items: this.state.initialItems})…

Today we are going to kick off the first installment in a new series of tutorials, Learning React, that will focus on becoming proficient and effective with Facebook’s React library. Before we start building anything meaningful, its important that we cover some base concepts first, so lets get this party started.
Continue reading “Learning React.js: Getting Started and Concepts ― Scotch”

Passing Functions to Components

  • Pass event handlers and other functions as props to child components: – – If you need to have access to the parent component in the handler, you also need to bind the function to the component instance (see below).
  • There are several ways to make sure functions have access to component attributes like and , depending on which syntax and build steps you are using.
  • In JavaScript, these two code snippets are not equivalent: – – Binding methods helps ensure that the second snippet works the same way as the first one.
  • Make sure you aren’t calling the function when you pass it to the component: – – Instead, pass the function itself (without parens): – – You can use an arrow function to wrap around an event handler and pass parameters: – – This is equivalent to calling : – -…
  • is a way of queuing a function to be executed in the browser at the optimal time for rendering performance.

If you need to have access to the parent component in the handler, you also need to bind the function to the component instance (see below).
Continue reading “Passing Functions to Components”

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”

Getting started with React Native

  • React Native helps you to build apps that no one would ever tell you that you did not use a custom native language such as JAVA or Swift or Objective C. React Native gives you that extra feel.
  • Create React Native App is the easiest way to start building a new React Native application.
  • It allows you to start a project without installing or configuring any tools to build native code – no Xcode or Android Studio installation required.
  • Do a change of directory to the location where you installed the React Native App.
  • NOTE: Create React Native App makes it really easy to run your React Native app on a physical device without setting up a development environment.

Getting to know React Native
Continue reading “Getting started with React Native”

All the Conditional Renderings in React

  • When a component has conditional rendering, the instance of the rendered component can have different looks.
  • The ternary operation makes the conditional rendering in React more concise than the if-else statement.
  • You can use a switch case operator to handle the conditional rendering of these multiple states.
  • Higher order components (HOCs) are a perfect match for conditional rendering in React.
  • They add control components to enable conditional renderings without JavaScript in JSX.

The article is an exhaustive list of conditional renderings in React. But what is conditional rendering in React? In a conditional render a component decides based on one or several conditions which elements it will return…
Continue reading “All the Conditional Renderings in React”

Getting Started #

Getting Started  #reactnative

  • Click “Apply” to download and install the Android SDK and related build tools.
  • Android Studio installs the most recent Android SDK by default.
  • 1. Download and install Android Studio #
  • react – native init AwesomeProject cd AwesomeProject react – native run – android
  • If you’ve already installed Android Studio before, you can still install HAXM without performing a custom installation.

Welcome to React Native! This page will help you install React Native on
your system, so that you can build apps with it right away. If you already
have React Native installed, you can skip ahead to the
Continue reading “Getting Started #”