reactjs - 盖茨比中 this.props.history.push 的等价物是什么?
问题描述
我正在尝试做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}`)
推荐阅读
- ios - 在 Swift 中获取 Google 日历事件时获取 NSError 域:“com.google.GTLJSONRPCErrorDomain”
- kendo-ui - 当树很大时,在剑道树中展开/折叠文件夹非常慢
- php - 从 Apple 服务器接收空白/无响应状态更新通知(statusUpdateNotification) - PHP v5.4.43
- java - How can i convert Map of Strings and Object to a Map of Strings and List
- java - 多个数据绑定错误
- python - x 坐标大于某个值的堆叠直方图(加权)中的 bin 计数
- bash - 如何将时间戳传递给日期并将其转换为日期时间?
- java - 如何删除键绑定
- r - R - 合并数据
- sql - SQL ORACLE 将表格转换为 html 代码