Closed gipyeong-lee closed 3 years ago
@Nosnibor35 Hello.
if you wanna use react-ion-slider
in your next.js application please follow below steps.
react-ion-slider
placed )
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossOrigin="anonymous"></script>
</Head>
{ssr:false}
option. cause, if you render this component in server side, node.js don't know about document
. so please implement option. {ssr:false}
const IonRangeSlider = dynamic(() => import('react-ion-slider'),{ssr: false})
@gipyeong-lee ,
Thank you very much for the response. I am going through your steps and when initially installing the react-ion-slider package after installing Next.js with 'create-next-app' I get a message that it could not resolve the dependency. The error I get when installing your package is:
Found: react@17.0.1 node_modules/react react@"17.0.1" from the root project
Could not resolve dependency: peer react@"^15.0.0 || ^16.0.0" from react-ion-slider@1.0.9 node_modules/react-ion-slider react-ion-slider@"*" from the root project
Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
What is your recommendation on that.
Thanks
Martin
@Nosnibor35
I modified peer dependencies like below
"react": "^15.0.0 || ^16.0.0 || ^17.0.0",
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0"
@gipyeong-lee,
Thanks for updating the package, I re-installed and only got the one error:
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
I still created the const you mentioned in the previous reply but it crashed with an internal server error and looking at the first line it states
error - ReferenceError: dynamic is not defined
Question, is it OK to use the
Cheers
Martin
@Nosnibor35 oh, let me check other modules.
Please import module dynamic
import dynamic from 'next/dynamic'
This library written react class.
@gipyeong-lee , YOU STAR!!!
Perfect, sorry I should have thought I needed to import dynamic. Just quickly tested it before work and it works great so far so thanks for the immediate support. 👍🏻
Thanks :) Now I close issue
Perfect, thank you again. I'm looking forward to developing my website now with your sliders 😉
Martin
On Mon, 22 Feb 2021 at 15:27, GiPYeongLee notifications@github.com wrote:
Thanks :) Now I close issue
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gipyeong-lee/react-ion-slider/issues/3#issuecomment-783454493, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3RKSCBCKSHUN3JBXP5N6TTAJZWNANCNFSM4X6LX7BA .
Hiya buddy,
I've been loving using your ion-slider on a page I have but I was wondering if you're ever thinking about porting it over to work on next.js? I've been trying but failing to get it working using your react-ion-slider package but getting issues due to upstream dependencies.
Cheers