Skip to content
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

Does not work with React #7

Open
kostberg opened this issue Sep 12, 2020 · 8 comments
Open

Does not work with React #7

kostberg opened this issue Sep 12, 2020 · 8 comments

Comments

@kostberg
Copy link

Tried to implement this cursor in my react app but it wasn't compatible. Could this be fixed?

@Frostbourn
Copy link

+1
I can't make it work with Gatsby.

@kostberg
Copy link
Author

Think this means we will have to fix this ourself :/

@Frostbourn
Copy link

Frostbourn commented Sep 17, 2020

Think this means we will have to fix this ourself :/

Just put the css files from cdn and everything should work.

@kkkarannn
Copy link

Any examples on how to get it working on React/Next.js

@Frostbourn
Copy link

Frostbourn commented Nov 4, 2020

To make kursor work with Gatsby just put the code below to gatsb-browser.js

import kursor from "kursor"

new kursor({
  type: 2,
  color: "#B98FFF",
  removeDefaultCursor: true,
})

@FranciscoMendes10866
Copy link

FranciscoMendes10866 commented Feb 12, 2021

Hi guys, I also had the same problem while using this dependency with Next.js.

Read this from the documentation to get a better understanding: https://bit.ly/3rMUWQL

"_document.jsx" code:

import Document, { Html, Head, Main, NextScript } from 'next/document'

class MyDocument extends Document {
  static async getInitialProps(ctx) {
    const initialProps = await Document.getInitialProps(ctx)
    return { ...initialProps }
  }
  render() {
    return (
      <Html lang="en">
        <Head>
            <link rel="stylesheet" href="https://unpkg.com/kursor/dist/kursor.css" />
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
        <script src="https://unpkg.com/kursor" />
        <script dangerouslySetInnerHTML={{__html:`new kursor({ type: 1, removeDefaultCursor: true })`}} />
      </Html>
    )
  }
}

export default MyDocument

Hope this helps 😉

@ksnirob
Copy link

ksnirob commented Dec 24, 2021

It's so easy to use like cutting a cake.

#import
import Kursor from "kursor";
import 'kursor/dist/kursor.css'

you can change the type as you want.

new Kursor({
type: 2
})

@Huzaifa-Ansari222
Copy link

my cursor only show on the hero section only not to all body by default it should be on body but not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants