question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected behaviors in React JS

See original GitHub issue

I installed the library using this command npm install TagCloud --save-dev and because of a types error I imported it like this const TagCloud = require('TagCloud');. After running the react app multiple spheres appear.

And another problem is when I change the javascript it doesn’t affect the sphere, also on every alternate reload it doesn’t load

import React from 'react';
import './about.scss';

function About() {
  const TagCloud = require('TagCloud');

  const myTags = [
    'JavaScript',
    'CSS',
    'HTML',
    'Vscode',
    'XD',
    'React',
    'Python',
    'Linux',
    'git',
    'Flutter',
    'Dart',
    'Firebase',
    'SASS',
    'JSON',
    'Figma',
  ];

  TagCloud('.content', myTags, {
    radius: 250,
    maxSpeed: 'fast',
    initSpeed: 'fast',
    direction: 135,
    keep: true,
  });

  return (
    <div className="About" id="About">
      <div className="left">
        <div className="heading">
          <h1>ABOUT</h1>
        </div>
        <div className="para">
          <p>
            I am a high school student located in India, I am passionate about
            UI designing, android development, web development and automation.
          </p>
          <br></br>
          <p>
            Love automating daily boring tasks using python, Linux OS, gaming
            and in sports: football and badminton.
          </p>
          <br></br>
          <p>
            <a href="#Contact">Contact me</a>
          </p>
        </div>
      </div>
      <div className="right">
        <span className="content"></span>
      </div>
    </div>
  );
}

export default About;

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
JorgeNavacommented, Jul 17, 2022

Great, thanks. Should we close de Issue? I think it’s more an issue with React rather than with the library

1reaction
Rohith-JNcommented, Jul 17, 2022

Oh for me this worked:

const IsTagCloudLoaded = useRef(false)

    useEffect(() => {
        if (IsTagCloudLoaded.current) return

        TagCloud('.content', Tags, {
            radius: 250,
            maxSpeed: 'fast',
            initSpeed: 'fast',
            direction: 135,
            keep: true,
        })

        IsTagCloudLoaded.current = true
    }, []) 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected behavior Using React useState, Very strange output
I am a newbie in React. I was experimenting around to see how things work, and I found a very strange Behavior of...
Read more >
Unexpected behavior when DOM structure is modified and re ...
Coding example for the question Unexpected behavior when DOM structure is modified and re-rendered in react-Reactjs.
Read more >
Keys in react - why using indexes could lead to unexpected ...
in this video I'll show you an example of why using the array index could lead to some unexpected behaviors, what the key...
Read more >
Cache unexpected behavior with react-native on Android #2694
I am using react-query in a react-native app. In iOS, everything is working as expected. On the other hand, on Android, the cache...
Read more >
React-Native: Unexpected behaviour of Instance Mesh on its ...
Hello,. I have found that the Instance Mesh behaviour is unexpected as like babylonjs in react-native, particularly when I move its parent ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found