0

I'm trying to access my search parameters. I can access the value of my name key but I can't seem to access the value of my value key. I think it has something to do with the hash # at the begining.

Here is my URL

  • http://localhost:3000/all/?name=Color&value=#03FFF7
const queryString = window.location.search
      if (queryString) {
        const urlParams = new URLSearchParams(queryString)
        const name = urlParams.get('name')
        const value = urlParams.get('value')
        console.log(`This is the ${value}`)
        this.setState({ name, nameValue: value })
      }
Obonyo
  • 141
  • 1
  • 7

0 Answers0