我正在尝试做 this.props.history.push("/payment/" + stripe_plan_id)
Gastby 中 this.props.history.push 的等价物是什么?
我收到错误 TypeError: Cannot read property 'push' of undefined
我正在尝试做 this.props.history.push("/payment/" + stripe_plan_id)
Gastby 中 this.props.history.push 的等价物是什么?
我收到错误 TypeError: Cannot read property 'push' of undefined
最佳答案不再有效但这确实有效:
import { navigate } from "gatsby"
navigate(`/payment/${stripe_plan_id.id}`)
Gatsby 使用到达路由器。请尝试以下操作:
import { navigate } from "@reach/router"
navigate(`/payment/${stripe_plan_id.id}`)