Skip to content

A simple hook implementation to implement Caast on a React project

Notifications You must be signed in to change notification settings

Caast/react-use-caast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caast.tv

Install

yarn add @caast/react-use-caast
# or
npm i @caast/react-use-caast --save

Description

This hook allow you to simply implement Caast library on a React project. It will inject the library in your DOM with your provided API keys. The caast instance will then be available in order to perform the available actions of the library.

Usage

import React, { useState, useEffect } from 'react';
import useCaast from '@caast/react-use-caast';

export default function App() {
  const caastInstance = useCaast({ app_id: 'MY_APP_ID', app_key: 'MY_APP_KEY' });

  useEffect(() => {
    if (caastInstance) {
      console.log('Caast is now loaded, you can now call Caast library methods', caastInstance.infos());
    }
  }, [caastInstance]);
}

About

A simple hook implementation to implement Caast on a React project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published