Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rovolution-react-async-branch

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rovolution-react-async-branch

a component that will asynchronously load, one of two components based on a condition

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

React Async Branch

A component that asynchronously loads a component depending on result of condition.

Install

npm install react-async-branch

Props

condition

if true loads and renders left, if false loads and renders right

left

component to render if condition is true

right

component to render if condition is false

loadingComponent

component to render while async component loads

...rest

additional props will be passed on to rendered component

Use

import React, { Component } from 'react';
import AsyncBranch from 'react-async-branch';
export default class SoCool extends Component {
	state = { condition: false };
	render() {
		return (
			<div onClick={() => this.setState({ shouldShow: true })}
				<AsyncBranch
					condition={this.state.condition}
					left={() => import('./left')}
					right={() => import('./right')}
					otherProp={"nice"}
				/>
			</div>
		);
	}
}

Keywords

FAQs

Package last updated on 22 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc