[英]“Cannot call a class as a function” react native in non component class
Crawler.js:
export class WebCrawler {
cookie_stores = [CookieStore(sisgrad_domain)];
...
App.js:
import { WebCrawler } from './crawler.js';
var MyCrawler = new WebCrawler();
export default class App extends Component<Props> {
render() {
return (
...
但是我得到“無法將類作為函數調用”。 我找到了有關此錯誤的多個答案。 他們中的一些人告訴我在類名之前使用new
,這是我在做的,其他人則說我必須擴展Component
。 但是我的Crawler
類在UI上什么也不做,為什么我應該擴展Component
?
我想CookieStore
也是一個類,所以您需要
new CookieStore
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.