mardi 16 mars 2021

Where to find @testing-library/react-native for class component

I have to test some class components in React Native. I can only find examples for functional component and hooks.

I can't find any examples. Do you where I can look at one?

If I test it like it was a functional component, returns this error:

({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){
import { Component, Children } from 'react';
^^^^^^

    SyntaxError: Cannot use import statement outside a module

      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
      at Object.<anonymous> (node_modules/react-native-root-siblings/lib/RootSiblings.js:2:1)

Aucun commentaire:

Enregistrer un commentaire