[英]“Cannot call a class as a function” react native in non component class
Crawler.js: Crawler.js:
export class WebCrawler {
cookie_stores = [CookieStore(sisgrad_domain)];
...
App.js: App.js:
import { WebCrawler } from './crawler.js';
var MyCrawler = new WebCrawler();
export default class App extends Component<Props> {
render() {
return (
...
But I'm getting “Cannot call a class as a function”. 但是我得到“无法将类作为函数调用”。 I've found multiple answers about this error.
我找到了有关此错误的多个答案。 Some of them tell to use
new
before the class name, which is what I'm doing, and the others say I must extend Component
. 他们中的一些人告诉我在类名之前使用
new
,这是我在做的,其他人则说我必须扩展Component
。 But my Crawler
class does nothing on the UI, why should I extend Component
? 但是我的
Crawler
类在UI上什么也不做,为什么我应该扩展Component
?
我想CookieStore
也是一个类,所以您需要
new CookieStore
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.