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.

Does this work with React?

See original GitHub issue

I’m trying to do something like:

import SVGInject from "@iconfu/svg-inject";

function Test() {
  return (
    <div>
             <img
                src={MySvg}
                onLoad={SVGInject(this)}
              />
    </div>
  );
}

Doesn’t seem to be doing anything. I don’t get an error, but the svg is still the same, and if I inspect it in console, it’s still img instead of svg

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
chrisabramscommented, Mar 19, 2021

Just to let you know that onLoad={(e) => SVGInject(e.srcElement)} did the trick for me.

That didn’t work for me, but onLoad={(e) => SVGInject(e.target)} did.

1reaction
joshuarobscommented, Oct 29, 2020

@Audreymlgm Nope, I’m not using this repo and I’m just using the <svg>...</svg> html tag

Read more comments on GitHub >

github_iconTop Results From Across the Web

React.js (Introduction and Working) - GeeksforGeeks
It defines the logical structure of documents and the way a document is accessed and manipulated.). So, to make it faster, React implements...
Read more >
How React works under the hood - freeCodeCamp
React allows you to effectively re-construct your DOM in JavaScript and push only those changes to the DOM which have actually occurred.
Read more >
What Is React and How Does It Actually Work? - Hostinger
React lets you reuse components that have been developed into other applications. Since ReactJS is open source, it's possible to pre-build components, cutting ......
Read more >
A Beginner's Guide to React: How does React work? - Medium
React is a JavaScript library (not a framework) that creates user interfaces (UIs) in a predictable and efficient way using declarative code.
Read more >
Tutorial: Intro to React
React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It lets you compose complex UIs from small and isolated...
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