-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can not use with react #632
Comments
thank You. but i do not use the Jest. |
thank You. i will to try it later. now the little helped me |
Because Node.js doesn't support for ECMAScript modules. For React: You can only import With me using useCallback for the best solution.(use const sliderElementRef = useCallback<(node: Element | null) => void>(
async node => {
if (node instanceof HTMLElement) {
const {tns} = await import('tiny-slider/src/tiny-slider');
const slider = tns({
container: node,
// other options
});
}
},
[],
);
return <div>
<div ref={sliderElementRef}>
<!-- Slider items -->
</div>
</div> |
when i use import { tns } from 'tiny-slider';
error tns is undefined in consol
when i use import { tns } from 'tiny-slider/src/tiny-slider'; or require ('tiny-slider/src/tiny-slider');
error
Unexpected token import
can You specify in documentation as right with react.js.
tiny-slider is the best slider but i can not use it with react. with plain html and js it the best. help me please use it without any wrapper.
Tiny-slider version:
2.9.3
The text was updated successfully, but these errors were encountered: