How to use the use-sidecar.sidecar function in use-sidecar

To help you get started, we’ve selected a few use-sidecar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github theKashey / react-remove-scroll / __tests__ / UI.tsx View on Github external
import * as React from 'react';
import {configure, mount} from 'enzyme';
import * as Adapter from 'enzyme-adapter-react-16';
import {RemoveScroll} from '../src/UI';
import {sidecar} from "use-sidecar";

configure({adapter: new Adapter()});

const tick = () => new Promise(resolve => setTimeout(resolve, 10));

const car = sidecar(() => import ('../src/sidecar'));

describe('UI', () => {
  it('smoke', async () => {
    const wrapper = mount(
      content
    );
    await tick();
    expect(wrapper.html()).toContain('content');
  });

  it('forward', async () => {
    const wrapper = mount(
      
        <div>content</div>
      
    );
github theKashey / react-focus-lock / examples / preact-parcel / app / Lock.tsx View on Github external
import { h } from 'preact';
import * as React from "react";
import FocusLockUI from "react-focus-lock/UI";
import {sidecar} from "use-sidecar";

const styles = {
  fontFamily: "sans-serif",
  fontSize: "16px"
};

const bg = {
  backgroundColor: '#FEE'
};

const FocusLockSidecar = sidecar(() =&gt; import("react-focus-lock/sidecar"));

class Trap extends React.Component {
  state = {
    disabled: true
  }

  toggle = () =&gt; this.setState({disabled: !this.state.disabled});

  render() {
    const {disabled} = this.state;
    return (
      
        {disabled &amp;&amp; <div></div>
github theKashey / react-focus-lock / stories / sideCar.js View on Github external
import React, {Component} from "react";
import {sidecar} from "use-sidecar";
import {FocusLockUI} from "../src/index";

const styles = {
  fontFamily: "sans-serif",
  textAlign: "center",
  fontSize: "16px"
};

const bg = {
  backgroundColor: '#FEE'
};

const FocusLockSidecar = sidecar(() =&gt; import("../src/sidecar"));

class Trap extends Component {
  state = {
    disabled: true
  }

  toggle = () =&gt; this.setState({disabled: !this.state.disabled});

  render() {
    const {disabled} = this.state;
    return (
      
        {disabled &amp;&amp; <div></div>

use-sidecar

Sidecar code splitting utils

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis