0

Im trying to implement the library Shufflejs together with ReactJS. Im trying to implement the samplecode for react but when I after installed Shufflejs with npm install shufflejs and paisted the code into index.js in my React application my page renders blank.

I'm a bit lost why that is. Any help would be appreciated!

the code is here on shufflejs: https://vestride.github.io/Shuffle/js/demos/react.js

4
  • Please add examples of your code so others can see how to help - are you getting any errors in the console? Commented Feb 15, 2019 at 14:05
  • the code is here on shufflejs: vestride.github.io/Shuffle/js/demos/react.js Im on a fresh react install. No I am not getting any errors so everything seems to work but returns blank. The only error message I dig get was: "Line 128: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images " but I fixed that by adding an alt="name" after that no errors. just returns as a blank page Commented Feb 15, 2019 at 14:15
  • Do you need to import shuffle? Commented Feb 15, 2019 at 14:49
  • Hm. Dont think so since I didnt got any error message ... Commented Feb 15, 2019 at 15:01

1 Answer 1

1

The way you load Shuffle is not correct here. Replace the import statements with

import React, { Component } from 'react'
import ReactDOM from "react-dom";
import Shuffle from 'shufflejs'
Sign up to request clarification or add additional context in comments.

1 Comment

thanks. It worked. Is the declaration const "React = window.React;" for when I load it it with cdn?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.