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

react-use-presentation

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-presentation

Create pure HTML (React enriched if you will) presentations.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source
traffic

react-use-presentation

Create pure HTML (React enriched if you will) presentations.

NPM

Preview here!


Table of Contents


Running example

Example


Install

npm install --save react-use-presentation

Usage

  • Set up your presentation array with each object acting as a movie frame. See the example and contract below:
const myFramesArray = [
  {
    component: <div>First Frame with 1 second duration</div>,
    time: 1000
  },
  {
    component: <div>Second Frame with 2 second duration</div>,
    time: 2000
  },
  {
    component: <div>Last Frame without duration</div>,
  }
]
  • To initialize a Presentation component:
import * as react from 'react';\
import usePresentation from 'react-use-presentation';

export default function App() {
  const Presentation = usePresentation({ framesOptions: myFramesArray1 });

  return (
    <Presentation />
  )
}
  • To initialize a delayed (in milliseconds) Presentation component:
import * as react from 'react';\
import usePresentation from 'react-use-presentation';

export default function App() {
  const DelayedPresentation = usePresentation({ framesOptions: myFramesArray2, startDelay: 1000 });

  return (
    <DelayedPresentation />
  )
}
  • To initialize a delayed (in milliseconds) and also in loop Presentation component:
import * as react from 'react';\
import usePresentation from 'react-use-presentation';

export default function App() {
  const DelayedAndLoopedPresentation = usePresentation({ framesOptions: myFramesArray3, startDelay: 1000, isLoop: true });

  return (
    <DelayedAndLoopedPresentation />
  )
}
  • To initialize multiple separated presentations:
import * as react from 'react';\
import usePresentation from 'react-use-presentation';

export default function App() {
  const Presentation = usePresentation({ framesOptions: myFramesArray1 });
  const DelayedPresentation = usePresentation({ framesOptions: myFramesArray2, startDelay: 1000 });
  const DelayedAndLoopedPresentation = usePresentation({ framesOptions: myFramesArray3, startDelay: 1000, isLoop: true });

  return (
    <DelayedAndLoopedPresentation />
  )
}

Documentation

usePresentation() constructor:

type TFrameOptions = {
  component: Component | null,
  time?: number
}

type TUsePresentation = {
  framesOptions: Array<TFrameOptions>,
  startDelay?: number,
  isLoop?: boolean
}

usePresentation(TUsePresentation);

usePresentation() returns:

  • Presentation: Component<{}, {}, any> | null

The Presentation component name is purely arbitrary i.e. MyLittleComponentPresentation will do just fine.


License

react-use-presentation is MIT licensed.


This hook is created using create-react-hook.

FAQs

Package last updated on 09 Feb 2021

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