Fork me on GitHub
#helix
<
2023-02-12
>
moliveira16:02:19

Hello! I'm trying to use https://github.com/molefrog/wouter with helix and when I try to call the hook useLocation an error happens (image attached). Do you guys have any tips on how could I solve this? Or should I ditch the Wouter library? package.json:

{
  "name": "plutus",
  "version": "0.0.1",
  "description": "A system for managing personal finances",
  "main": "index.js",
  "repository": ":heset/plutus.git",
  "author": "Mauricio Oliveira <[email protected]>",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "@headlessui/react": "^1.7.10",
    "@heroicons/react": "^2.0.13",
    "axios": "^1.3.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-refresh": "^0.14.0",
    "wouter": "^2.10.0-alpha.4"
  },
  "devDependencies": {
    "shadow-cljs": "^2.20.19",
    "tailwindcss": "^3.2.4"
  }
}

lilactown17:02:01

based on the error message, sounds like a problem with your code. it says you're calling the hook outside of a component. without anymore info, I would advise you to look over your code and make sure that you are calling useLocation inside of a component đŸ™‚

moliveira20:02:52

I'm sure the https://gitlab.com/heset/plutus/-/blob/main/src/cljs/plutus/api.cljs#L25 is called inside of a https://gitlab.com/heset/plutus/-/blob/main/src/cljs/plutus/core.cljs#L45. Perhaps because it is inside a clojure function react is having trouble instrumenting something?