gatsby中的this.props.history.push等效于什么? [英] What's the equivalent of this.props.history.push in gatsby?
本文介绍了gatsby中的this.props.history.push等效于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试this.props.history.push("/payment/" + stripe_plan_id)
Gastby中的this.props.history.push等效于什么?
What is the equivalent of this.props.history.push in Gastby?
我收到错误TypeError: Cannot read property 'push' of undefined
推荐答案
盖茨比使用到达路由器.请尝试以下操作:
Gatsby uses reach router. Try the following:
import { navigate } from "@reach/router"
navigate(`/payment/${stripe_plan_id.id}`)
这篇关于gatsby中的this.props.history.push等效于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文