In this lesson, you will learn how to extend styles from one styled-component to another in a React app. This is helpful when you have two styled-components that are similar but differ in one or more CSs properties. import styled from 'styled-compone…
1 1 1 https://www.fullstackreact.com/articles/react-create-class-vs-es6-class-components/ React.createClass vs. ES6 Class Components New React developers are often confused when they encounter two different styles for declaring React components. The…
React loves svg just as much as it loves html. In this lesson we cover how simple it is to make SVG components in ReactJS. Creating SVG components with React allows you to inline SVG. Inline SVG has an advantage that it can be styled with CSS just li…
Due to the way that React Context Providers work, our current implementation re-renders all our compound component consumers with every render of the <Toggle /> which could lead to unnecessary re-renders. Let's fix that by ensuring that the value pr…
In this session we create a comment component to explore how to create components that only render text. In previous versions of we had to wrap our text in needless <span> or <div>, we will see how React 16 removes the unneeded structure. impo…
We can utilize React.cloneElement in order to create new components with extended data or functionality. class App extends React.Component { render(){ return ( <Buttons> <button value="A">A</button> <button value="B&quo…
Similar to the State Hook, the Effect Hook is “first-class” in React and handy for performing side effects in function components. The Effect Hook is called by passing a function as the first argument. Here, you can perform side effects. If needed, y…
Because @types/react has to expose all its internal types, there can be a lot of confusion over how to type specific patterns, particularly around higher order components and render prop patterns. The widest and most recommended element type is React…
In order to illuminate a scene containing 3D objects a lighting setup is required. In this lesson we'll walk through the available lighting components and create a common outdoor lighting setup. This includes the components: <AmbientLight/>, which a…
React Router v4 allows us to render Routes as components wherever we like in our components. This can provide some interesting use cases for creating dynamic routes on our applications. import React from 'react'; import { BrowserRouter as Router, Rou…
Here we refactor a React TypeScript class component to a function component with a useState hook and discuss how props and state types can be modeled accordingly. import * as React from "react"; import { render } from "react-dom"; impo…
You often find duplication between the name of a prop and a variable you will assign to the prop. JSX allows you to spread an object containing your named props into your Component which enables you to avoid the repetition of matching prop names and…
Storybook is a UI component development environment for React, Vue, and Angular. With that, you can develop UI components without running your app. Here I show how to add a landing/welcome page to your Storybook, so that first-time viewers get to rea…
In this lesson, you will learn how to use the SafeAreaView component to avoid the sensor cluster (the notch) and home activity indicator on the iPhone X. SafeAreaView is similar to the View, just for iphone X, the screen is different from previous ve…
In this lesson we will use Animated.spring and TouchableWithoutFeedback to animate the scale of a button in our React Native application. We will use the scale transform property and see how adjusting the friction of a spring will effect the spring a…