0

I am trying to use the URLPattern browser api inside of my react app and I am getting an error Line 9:19: 'URLPattern' is not defined no-undef

the breaking code

const p = new URLPattern('https://example.com/foo/:image.jpg?*#*');

What are my doing wrong? My browser supports this feature.

user14665310
  • 524
  • 4
  • 13
  • That's a linting error. Your linter doesn't seem to know about `URLPattern`, probably because it's experimental. You should typically be able to list it as a global – Phil May 12 '22 at 23:59
  • https://developer.mozilla.org/en-US/docs/Web/API/URLPattern/URLPattern#browser_compatibility does not say that it is experimental – user14665310 May 13 '22 at 00:01
  • how do I list this as global? – user14665310 May 13 '22 at 00:02
  • Do you not see the flask icon and _"Experimental. Expect behavior to change in the future."_? – Phil May 13 '22 at 00:03
  • see it now I can't figure out how to add this to the global list in my app I am using create react app – user14665310 May 13 '22 at 00:05
  • See the duplicate I linked at the top of your question. See also [Using Global Variables](https://create-react-app.dev/docs/using-global-variables/) for an alternative – Phil May 13 '22 at 00:06

0 Answers0