Giter VIP home page Giter VIP logo

Comments (5)

devmrobot avatar devmrobot commented on May 31, 2024 1

Hi,
I succeeded to add react-special-cursor in my Next.js with next-transpile-modules :

1/ installation

npm i next-transpile-modules

2/ Modify next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  eslint: {
    ignoreDuringBuilds: true,
  },
}

const withTM = require("next-transpile-modules")([
  "react-special-cursor",
]);

module.exports = withTM({
  nextConfig
});

3/ add css in _app.js

import "../styles/globals.scss";
import "../styles/fonts.scss";
import "react-special-cursor/src/Cursor/Cursor.scss"

function MyApp({ Component, pageProps }) {
  return <Component {...pageProps} />;
}

export default MyApp;

4/ import react-special-cursor in component

from react-special-cursor.

amirho1 avatar amirho1 commented on May 31, 2024

inside the Cursor.js, it is calling the Cursor.scss remove it and check other files also besides that I haven't tested it on server-side rendering libs like nextjs.
if it worked correctly with simple import that's good if not try to import it dynamically on the front I think next has its doc about it

cursor

from react-special-cursor.

devmrobot avatar devmrobot commented on May 31, 2024

Thank's for your help !
I will try asap.

from react-special-cursor.

amirho1 avatar amirho1 commented on May 31, 2024

Since it's not an issue, I will close it but fill free to reopen it or ask questions.
Also, were you able to fix the problem and use the cursor?

from react-special-cursor.

devmrobot avatar devmrobot commented on May 31, 2024

The problem now is from using css Module with sass in next.js, so I can't use hoverClasses with className={styles.error}.
https://nextjs.org/docs/basic-features/built-in-css-support

 <Cursor
      hoverClasses={[
        { classNameOfTargetElement: "head", classNameOfStyle: "head-hover" },
...

from react-special-cursor.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.