小编BLS*_*SPR的帖子

JSX 元素类不支持属性,因为它没有“props”属性。ts(2607)

当我使用react-easy-crop库中的“Cropper”时出现此错误,我尝试了在论坛上找到的一些方法,例如添加@types/react、从“react”导入*作为React,但似乎没有任何效果工作。

这是给我带来麻烦的代码:

import * as React from "react";
import Cropper from "react-easy-crop";

export default function CropperPage({action , valuePro}: any) {
   return (
     <Cropper //  <-- This is giving me the error
        cropShape= "round"
        disableAutomaticStylesInjection="true"
        image={image}
        crop={crop}
        zoom={zoom}
        aspect={1}
        onCropChange={setCrop}
        onZoomChange={setZoom}
        onCropComplete={onCropComplete}
    />
   );
}
Run Code Online (Sandbox Code Playgroud)

整个错误信息是:

Blockquote JSX 元素类不支持属性,因为它没有“props”属性。ts(2607)“Cropper”不能用作 JSX 组件。其实例类型“Cropper”不是有效的 JSX 元素。类型“Cropper”缺少类型“ElementClass”中的以下属性:context、setState、forceUpdate、props、refsts(2786)(别名)class Cropper import Cropper

html javascript jsx reactjs tsx

49
推荐指数
2
解决办法
6万
查看次数

将 char * 转换为 char ** 时出现分段错误

我试图将一个句子 (char *) 拆分为一个单词数组 (char **)。问题是我的函数有时不会返回有效的 char ** 。

char **get_words(char *buffer, char delimiter)
{
    char **words = malloc(sizeof(char *) * 4096);
    for (int i = 0; i < 4096; i++)
        words[i] = malloc(sizeof(char) * 4096);
    int word_count = 0;
    int l = 0;
    for (int i = 0; buffer[i] != '\0' && buffer[i]  != '\n'; i++, l++) {
        if (buffer[i] == delimiter) {
            words[word_count][l] = '\0';
            word_count++;
            l = -1;
        }
        else
            words[word_count][l] = buffer[i];
    }
    words[word_count][l] = '\0'; …
Run Code Online (Sandbox Code Playgroud)

c valgrind

2
推荐指数
1
解决办法
298
查看次数

Haskell 有一个函数接受未知数量的参数作为参数

我需要像这样调用我的函数: myFunc 1 5 4 3 6 2 7 8 9 5 1 3 或者 myFunc 2 6 4

如何编写我的类型,以便它接受未知数量的参数并将它们放入列表中?我想做这样的事情:

myFunc :: Int -> IO ()  -- I don't know what type to put replace Int with 
myFunc a = 
    return a
Run Code Online (Sandbox Code Playgroud)

myFunc 1 2 5 4 8 应该返回 [1,2,5,4,8]

haskell types

0
推荐指数
1
解决办法
376
查看次数

标签 统计

c ×1

haskell ×1

html ×1

javascript ×1

jsx ×1

reactjs ×1

tsx ×1

types ×1

valgrind ×1