reactjs - gatsby 中的 this.props.history.push 相当于什么?

标签 reactjs gatsby

我正在尝试执行 this.props.history.push("/payment/"+ stripe_plan_id)

Gastby 中的 this.props.history.push 相当于什么?

我收到错误TypeError:无法读取未定义的属性“push”

最佳答案

最上面的答案不再有效,但这确实有效:

import { navigate } from "gatsby"  
navigate(`/payment/${stripe_plan_id.id}`)

关于reactjs - gatsby 中的 this.props.history.push 相当于什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58677568/

相关文章:

node.js - javascript 中的 import * 代表什么?

javascript - 无法在 react 映射之外访问返回值

reactjs - 为什么我的 ImageBackground 不再延伸到屏幕底部?

node.js - 这是有效的 Node.js 要求吗? "const { EXAMPLE.SOMETHING } = require (' 示例')"

reactjs - 将预先存在的静态 HTML 页面添加到 React/Gatsby 站点的最快方法

javascript - 如何设计 react 选择组件的箭头样式?

html - 工具提示在布局之上,滚动条将其隐藏在里面。 Z 索引不起作用

javascript - 如何为 GatsbyJS 制作仅客户端组件?

javascript - 重命名 webpack/gatsby block 映射字符串

wordpress - 带有 wordpress 的 Gatsby 找不到未使用的 ACF 灵活内容字段