I'm trying to create a React sandbox with the following code:
declare const $: any;
This works in my own codebase without having to do anything special. I get an "Unexpected token, expected" error, though.
How can I get use jQuery in CodeSandbox and get $ to work?
Heya! You can use jQuery by doing something like this:
import $ from 'jquery';
// Now you can use $
or you can add jQuery (https://code.jquery.com/jquery-3.2.1.min.js) under External Resources under Dependencies in the sidebar.
We have plans to add better support for custom aliases, so that would make it possible to do this in the future.
Most helpful comment
Heya! You can use jQuery by doing something like this:
or you can add jQuery (https://code.jquery.com/jquery-3.2.1.min.js) under External Resources under Dependencies in the sidebar.
We have plans to add better support for custom aliases, so that would make it possible to do this in the future.