Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useState is not working with antd table #17023

Closed
1 task
minhyeong-jang opened this issue Jun 10, 2019 · 3 comments
Closed
1 task

useState is not working with antd table #17023

minhyeong-jang opened this issue Jun 10, 2019 · 3 comments
Assignees
Labels
🤔 Need Reproduce We cannot reproduce your problem

Comments

@minhyeong-jang
Copy link

minhyeong-jang commented Jun 10, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

#17022

Steps to reproduce

const [stockEdit, setStockEdit] = useState({
    key: "",
    value: ""
});
...
console.log(stockEdit); // { key: "changeKey", value: "changeValue" }
const columns = [{
      title: "asd",
      dataIndex: "",
      align: "center",
      key: "stockCount",
      width: 70,
      render: row => {
        console.log(stockEdit); // console.log({key: "", value: ""}
     }
}];
const updateStock = props => {
  setStockEdit(key: "changeKey", value: "changeValue");
}
...
console.log(stockEdit);  // console.log({key: "changeKey", value: "changeValue"}

What is expected?

Why Hooks not working in antd table??

When I tried setStockEdit(key: "changeKey", value: "changeValue");,
Rendering is success. but only not work antd table.

Why not change stockEdit in columns render?

What is actually happening?

state is not work in antd table

Environment Info
antd 3.19.3
React react 16.8.6
System mac os
Browser chrome
@afc163 afc163 added the 🤔 Need Reproduce We cannot reproduce your problem label Jun 10, 2019
@ant-design-bot
Copy link
Contributor

Hello @minhyeong-jang. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 7 days.

你好 @minhyeong-jang, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。7 天内未跟进的 issue 将会被自动关闭。

@afc163 afc163 closed this as completed Jun 18, 2019
@afc163
Copy link
Member

afc163 commented Jun 18, 2019

又不会自动关闭了 @yesmeck

@yoyo837
Copy link
Contributor

yoyo837 commented Sep 5, 2019

<Table columns={columns()} />

columns = () => ([{
   title: "asd",
      dataIndex: "",
      align: "center",
      key: "stockCount",
      width: 70,
      render: row => {
        console.log(stockEdit); // console.log({key: "", value: ""}
     }
}])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Need Reproduce We cannot reproduce your problem
Projects
None yet
Development

No branches or pull requests

5 participants