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.

Potential conflicts with svg elements

See original GitHub issue

There’s a few svg tags that might conflict with react-three-fiber like line, path, and mesh (see: https://developer.mozilla.org/en-US/docs/Web/SVG/Element)

I’ve just been using Three’s Line element and VSCode seems to think it’s an svg element. Thankfully it uses the Three component I want, but what if I want to use svg in the future?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
asparagiicommented, Jun 5, 2020

Typescript complains about it though!

I’m trying to use fiber’s <line>, but Typescript thinks it’s a JSX.IntrinsicElements.line: React.SVGProps<SVGLineElement>, which of course is not.

Ignoring the line with a @ts-ignore works, of course, but it’s kind of annoying

4reactions
asparagiicommented, Oct 13, 2021
import { extend } from 'react-three-fiber';
import { Line } from 'three';

// Add class `Line` as `Line_` to react-three-fiber's extend function. This
// makes it so that when you use <line_> in a <Canvas>, the three reconciler
// will use the class `Line`
extend({ Line_: Line });

// declare `line_` as a JSX element so that typescript doesn't complain
declare global {
    namespace JSX {
        interface IntrinsicElements {
            'line_': ReactThreeFiber.Object3DNode<Line, typeof Line>,
        }
    }
}

After doing this somewhere in your application you can use <line_> instead of <line> and Typescript won’t get confused.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pmndrs/react-three-fiber - Potential conflicts with svg elements
I've just been using Three's Line element and VSCode seems to think it's an svg element. Thankfully it uses the Three component I...
Read more >
svg styles interfering with each other - Stack Overflow
I collect all class names and properties and apply them manually onto the SVG elements. const svgCollection = document.querySelectorAll( 'svg' ); ...
Read more >
Document Structure — SVG 2
Specifically: 'audio', 'canvas', 'circle', 'ellipse', 'foreignObject', 'iframe', 'image', 'line', 'path', 'polygon', 'polyline', 'rect', 'text', 'textPath', ' ...
Read more >
SVG conflict - WordPress.org
Hallo! I have a doubt. I'm using SVG (IMAGES) in my website but the plugin to upload the SVG is in conflict. My...
Read more >
svg elements with an img role must have an alternative text
svg elements with an img role must have an alternative text · What this Accessibility Rule Checks · Related Accessibility Rules Checked by...
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