score:18

Accepted answer

it seems that somewhere in this code you have an element with an explicit javascript code somewhere in it's attributes. something along the lines of

<a href="javascript:;" ...>...</a>

as the warning mentions: react was passed "javascript:;". this is probably some old repo, that was using this to get away with <a> tags that do not lead anywhere. the more common solution to this is usig href='#'.

however, the 404 you are getting is probably signifying something more and the repo itself is probably broken.

score:0

you can define a component based on a element. the followings are a bunch of code snippets.

import react, { fc, mouseevent } from 'react'
import classnames from 'classnames'

import './navigator.scss'

export interface inavigatorprops {
  classname?: string
  prefixcls?: string
  style?: react.cssproperties

  url: string

  onclick?: (event: mouseevent<htmlanchorelement>) => void
}

export const navigator: fc<inavigatorprops> = ({
  style,
  children,
  url: oldurl,
  classname = '',
  onclick: oldonclick,
  prefixcls = 'pa-navigator',
}) => {
  const classnamestring = classnames(classname, prefixcls)

  let [url = oldurl, onclick = oldonclick] = []
  if (/^javascript:/.test(url) || url === '#') {
    // @ts-ignore
    url = undefined

    onclick = (event) => {
      event.stoppropagation()

      oldonclick?.call(object.create(null), event)
    }
  }

  return (
    <a
      href={url}
      style={style}
      classname={classnamestring}
      onclick={onclick}
      rel='noopener noreferrer'
    >
      {children}
    </a>
  )
}


Related Query

More Query from same tag