Needlessly Promiscuous, Modularize!

    tawkto-react

    2.0.3 • Public • Published

    tawkto-react

    A simple script which help integrate tawk.to chat into any react application

    Getting Started

    Installing

    Install package by running

    npm install tawkto-react --save
    

    Usage in class component

    import tawkTo from "tawkto-react";
    
    const tawkToPropertyId = 'get_property_id_from_tawkto_dashboard'
    
    // Direct Chat Link
    // https://tawk.to/chat/tawkToPropertyId/tawkToKey
    
    const tawkToKey = 'get_key_from_tawkto_dashboard'
    
    
    componentDidMount(){
        tawkTo(tawkToPropertyId, tawkToKey)
    }
    

    Usage in functional component

    import tawkTo from "tawkto-react";
    
    const tawkToPropertyId = 'get_property_id_from_tawkto_dashboard'
    
    // Direct Chat Link
    // https://tawk.to/chat/tawkToPropertyId/tawkToKey
    
    const tawkToKey = 'get_key_from_tawkto_dashboard'
    
    useEffect(() => {
        tawkTo(tawkToPropertyId, tawkToKey)
    }, [])
    

    Function must be called after the DOM is loaded, such as inside componentDidMount or useEffect.

    Authors

    • Steve Junior

    Install

    npm i tawkto-react

    DownloadsWeekly Downloads

    1,077

    Version

    2.0.3

    License

    ISC

    Unpacked Size

    5.09 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar