2 Cookbook
Benjy Cui edited this page 2016-02-23 11:23:45 +08:00
This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Feel free to contribute to antd Cookbook by adding a snippet you've found useful.

Re-use locale config for Popconfirm Modal etc...

There is no locale property on Popconfirm. So, we have to set button text by okText and cancelText, it is inconvenient to re-use locale config for different components. However, we can set properties by spreading attributes, which makes re-use locale config easier.

const locale = {
  okText: 'Yes',
  cancelText: 'No',
};

<Popconfirm {...locale} title="Are you sure?">
  <a href="#">Delete</a>
</Popconfirm>