0

How do I have to configure my React project to be able to use the code below:

$(window).stellar()

I'm using Webpack and ProviderPlugin, and design is ready - only thing left is to install and attach Stellar library

VanDavv
  • 836
  • 2
  • 13
  • 38

1 Answers1

0

To use jquery with React, here is as sample code:

import $ from 'jquery';

... // here goes class definition and constructor 

componentDidMount() {
  $(window).stellar()
}

componentWillUnmount() {
  $(window).stellar("destroy");
}

I hope this helps.

Kafo
  • 3,568
  • 1
  • 12
  • 19
  • I get `Uncaught TypeError: $(...).stellar is not a function` when using as You do. jQuery is attached automaticly in provider plugin, but I think that stellar is not included by default – VanDavv Sep 09 '16 at 12:19
  • 1
    I was assuming you are using es6 as well as have stellar installed. What is the node module name that have stellar in it? – Kafo Sep 09 '16 at 14:33
  • i'm using es6 but i haven't installed stellar, since it has never worked. Could You update Your answer to show which package do I have to install? – VanDavv Sep 09 '16 at 15:12