Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 重新呈现组件反应表_Reactjs_React Table_React Component_Rerender - Fatal编程技术网

Reactjs 重新呈现组件反应表

Reactjs 重新呈现组件反应表,reactjs,react-table,react-component,rerender,Reactjs,React Table,React Component,Rerender,我正在尝试重新渲染组件。我有一个刷新按钮,我想在单击时清除所有过滤器和排序值。 问题是,我无法进行重新渲染,即使使用forceUpdate(),它也无法执行任何操作,我不知道为什么。另外,我尝试了setState(),但什么也没有。我希望发生的是当我更改页面时,它会重新呈现组件。请问有人能帮我吗?我做错了什么 import React,{Component}来自“React”; 从“./components/DeleteComponent”导入DeleteComponent 从“反应表”导入反

我正在尝试重新渲染组件。我有一个刷新按钮,我想在单击时清除所有过滤器和排序值。 问题是,我无法进行重新渲染,即使使用forceUpdate(),它也无法执行任何操作,我不知道为什么。另外,我尝试了setState(),但什么也没有。我希望发生的是当我更改页面时,它会重新呈现组件。请问有人能帮我吗?我做错了什么

import React,{Component}来自“React”;
从“./components/DeleteComponent”导入DeleteComponent
从“反应表”导入反应表;
从“react router dom”导入{Link,withRouter};
从“axios”导入axios;
从“../helpers/jwt”导入{getJwt}
从“../img/eye.png”导入眼睛
从“../img/bin.png”导入bin
从“../img/writing.png”导入写入
类CustomReactTable扩展组件{
建造师(道具){
超级(道具)
此.state={
数据:[],
showDelete:false,
项目:空,
页码:空,
totalItems:null,
加载:false,
国家:{},
}
}
fetchData=(状态)=>{
this.setState({state:state})
常量jwt=getJwt()
如果(!jwt){
this.props.history.push(“/login”)
}
让配置={
标题:{'Authorization':'Bearer${jwt}`,
参数:{
page:state.page,
pageSize:state.pageSize,
排序:state.sorted,
过滤:state.filtered
}
}
this.setState({loading:true})
axios.get(`http://localhost:3001/api/v1${this.props.location.pathname}`,config)
。然后(响应=>{
console.log(响应)
这是我的国家({
数据:response.data.result,
加载:错误
})
})
axios.get(`http://localhost:3001/api/v1${this.props.location.pathname}/count documents`,config)
。然后(响应=>{
这是我的国家({
totalItems:response.data.result,
页面:Math.ceil(response.data.result/state.pageSize)
})
})
}
加载选项=()=>{
这个是.props.columns.push({
标题:“”,
单元格:(行)=>[
//找到添加唯一密钥的更好方法
,
,
{this.onClickDeleteButton(row.original.\u id)}>
]
})
}
加载功能=()=>{
返回(
添加新的{this.props.modelName}
刷新表
)
}
onClickDeleteButton=(id)=>{
this.setState({showDelete:true,item:id})
}
onCancelDeleteClick=()=>{
this.setState({showDelete:false})
}
componentDidMount(){
这是loadOptions()
}
重新加载数据=()=>{
this.fetchData(this.state.state)
}
render(){
返回(
{this.state.showDelete&&(
)}
{`${this.props.modelName}(${this.state.totalItems})`}
{this.loadFunctionaties()}
{this.props.modelName}:{this.state.totalItems}
)
}
}
使用路由器导出默认值(CustomReactTable)