reactjs - 如何使用浏览器的后退按钮获取上一个搜索页面
问题描述
我有一个搜索页面,它重定向到search results page
使用以下逻辑
<input id="search" type="search" placeholder="search ..." className="osLight english" name="query"
onChange={this.handleChange}
/>
{
this.state.searchProperties.length > 0 &&
<Redirect to={{
pathname: '/search',
results: this.state.searchProperties
}} />
}
现在...在搜索结果中,我可以单击并转到其中一种产品
const properties = this.props.location.results;
<div className="col-xs-12 col-sm-12 col-md-6 col-lg-6 arabic-english">
<Link className="card" to={{
pathname: "/" + property.property_id,
property: property
}}
>
...
</Link>
</div>
但是现在当我在浏览器中按回时我会进入一个空白search result page
,我如何保持搜索结果状态以便在我按回时被查看?
解决方案
推荐阅读
- ruby-on-rails - rails select查询为属性名称创建别名
- python - TypeError: login() 得到了一个意外的关键字参数 'template_name'
- python - 如何将 JSON 文件解析为 Python 列表
- algorithm - 我应该将行业分类代码视为 K 均值聚类中的双重数据类型吗?
- c - 何时/何处分配本地数组?
- javascript - 使用 Dropzone.js 获取存储的图像
- java - 如何比较 MapReduce 中不同文件的信息?
- php - 表 php 中的 if 语句
- metal - Metal如何将图像块分配给每个线程组?
- android - android 应用程序打开时,如何编写运行 JavaScript 的 html 文件?