How to use Fancybox in ReactJs? #68
Unanswered
voducmanh99
asked this question in
Q&A
Replies: 1 comment
-
Hi, You simply have to adjust file paths. If you have installed import { Fancybox as NativeFancybox } from "@fancyapps/ui";
import "@fancyapps/ui/dist/fancybox.css"; Quick demo - https://codesandbox.io/s/fancybox-react-demo-9k2kz |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
code exp:
import React, { useEffect } from "react";
import NativeFancybox from "/static/lib/[email protected]/fancybox.esm.js";
import "/static/lib/[email protected]/fancybox.css";
function Fancybox(props) {
const delegate = props.delegate || "[data-fancybox]";
useEffect(() => {
NativeFancybox.assign(delegate, props.options || {});
}, []);
return <>{props.children}</>;
}
export default Fancybox;
=> I can't import NativeFancybox nor can I find the NativeFancybox module to import in React
Beta Was this translation helpful? Give feedback.
All reactions