简体   繁体   English

TypeError: props.render is not a function in React.js, Commerce.js, Stripe 应用项目

[英]TypeError: props.render is not a function in React.js, Commerce.js, Stripe application project

I am getting the following error but not sure why, and it points to this line.我收到以下错误,但不知道为什么,它指向这一行。

useEffect(() => {
    if (cart.id) {
      const generateToken = async () => {

25 | try {
  26 |   const token = await commerce.checkout.generateToken(cart.id, { type: 'cart' });
  27 | 
> 28 |   setCheckoutToken(token);
     | ^  29 | } catch {
  30 |   if (activeStep !== steps.length) history.push('/');
  31 | }
  };

      generateToken();
    }
  }, [cart]);

also it shows:它还显示:

 1 | import { ControllerProps, FieldPath, FieldValues } from './types';
  2 | import { useController } from './useController';
  3 | 
> 4 | const Controller = <
  5 |   TFieldValues extends FieldValues = FieldValues,
  6 |   TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
  7 | >(

I had the same problem.我有同样的问题。 I had to reinstall the earlier version of react-hook-form.我不得不重新安装早期版本的 react-hook-form。 Type into the terminal: npm install react-hook-form@6.2.0在终端输入:npm install react-hook-form@6.2.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError: props.render is not a function (React hook form) - TypeError: props.render is not a function (React hook form) react.js 和 commerce.js 问题,购物车值 totalItems 没有正常工作 - react.js and commerce.js problem, cart value totalItems isnt working as it should 获取 TypeError: t 在 React 中未定义,同时访问 commerce.js 公钥 - Getting an TypeError: t is undefined in React while accessing commerce.js public key 将props的值从函数传递到React.JS中的render() - Pass the value of a props from a function to render() in React.JS TypeError:无法使用 commerce.js 读取未定义的属性“toLowerCase” - TypeError: Cannot read property 'toLowerCase' of undefined with commerce.js React.js TypeError this.props未定义 - React.js TypeError this.props is undefined React.js,this.props.changeTitle不是一个函数 - React.js, this.props.changeTitle is not a function 反应.js | 如果我将 setState 作为回调 function 传递,则无限渲染,即使在解构道具之后也是如此 - React.js | Infinite render if I pass setState as a callback function, even after destructuring props React.js TypeError: Object(...) 不是函数 - React.js TypeError: Object(...) is not a function 类型错误:……地图不是 function - react.js - TypeError : …map is not a function - react.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM