Skip to main content
All CollectionsInstalling Sleekplan
How to install Sleekplan with ReactJS
How to install Sleekplan with ReactJS

Installing Sleekplan with React

Updated over 3 years ago

Installing Sleekplan with React is very easy. Here is the solution

  1. Go to Settings. Then, Widget / Website Settings.

  2. Copy the JavaScript code

  3. Go to your React codebase and find the main component.

    class App extends React.Component {
    componentDidMount () {
    // Include the Sleekplan code here, without the <script></script> tags
    window.$sleek=[];
    window.SLEEK_PRODUCT_ID=YOURPRODUCT_ID;
    (function(){d=document;
    s=d.createElement("script");
    s.src="https://client.sleekplan.com/sdk/e.js";
    s.async=1;
    d.getElementsByTagName("head")[0].appendChild(s);
    })();
    };
    render () {
    return (
    <Router>
    <Route path="/" component={LogPageView} />
    <div className="content">
    <PageWrapper>
    <Header title="Site Title" />
    <Routes />
    <Footer />
    </PageWrapper>
    </div>
    </Router>)
    }
    }
    export default App
Did this answer your question?