“Cannot call a class as a function” react native in non component class

253
March 26, 2018, at 03:01 AM

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 (
...

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. But my Crawler class does nothing on the UI, why should I extend Component?

Answer 1

I guess CookieStore is a class too, so you need to do

  new CookieStore
READ ALSO
JavaScript - I&#39;m reading a json file and trying to read the values of a certain key

JavaScript - I'm reading a json file and trying to read the values of a certain key

So here is my javascript code, I am looping over my json file which is below and I want to check the 'bought_together' values that are nested under 'related' but I can't seem to do it with my code I've got so farI'm using 'document

134
How to display API data using axios with React?

How to display API data using axios with React?

I have the following code which works perfectly on a list of objects assigned to a constBut whenever I take the list of objects from a DRF API endpoint, I can console

177
XDEBUG installation reading wrong PHP version

XDEBUG installation reading wrong PHP version

I have an Ubuntu 1604 vagrant box running on php 7

181
MySQL pivot: show horizontally different dates with same id

MySQL pivot: show horizontally different dates with same id

There is a table with more than 1000 idsEach id can have up to 10 different dates

93