JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

Warning: [antd: Modal] Static function can not consume context like dynamic theme. Please use 'App' component instead.

发布时间 2024-01-03 10:41:53作者: 风花一世月

react 的model.confirm报错,它意味着你在使用动态主题(Dynamic Theme)时不能在静态函数中使用上下文,需要使用contextHolder


const [modal, contextHolder] = Modal.useModal();

React.useEffect(() => {
  modal.confirm({
    // ...
  });
}, []);

return <div>{contextHolder}</div>;

 

    本栏目推荐文章
  • 2024-01-13 Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. ==》引用了未使用的方法导致
  • [Vue warn]: Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".
  • ClickHouse安装登录warning处理记录
  • koa2 使用koa-body引入报错 koaBody is not a function
  • 关于函数式接口中常用的Supplier、Consumer、predicate、Function的总结以及其使用场景
  • 使用的antd的pro-table时,遇到了两种引入方法---@ant-design/pro-components和@ant-design/pro-table的区别
  • naming conflicts with other components【vue3】
  • JavaScirpt | String Function (三)
  • Ant Design pro Component 【Schema Form - JSON 表单】依赖与顺序加载问题
  • Python中numpy出现has no attribute '_no_nep50_warning'错误的一个解决方案
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们