enzyme icon indicating copy to clipboard operation
enzyme copied to clipboard

Getting issue with mounting the component

Open msreddy09 opened this issue 4 years ago • 1 comments

My component is having ref, so I have tried to render the component by mount

But I am getting the following errors

Const wrapper = mount (<MyGraph {...componentProps} />); ^ Element type is invalid : expected a string (for built-in components ) or a class / function (for composite components) but got: undefined . you likely forgot to export your component from the file it’s defined in or you might have mixed up default and named imports

The minimal component structure is

leftClick(){
  this.ref.scrollview.scrollTo()
}
reder() {
  return (
  <View>
     ----
     <ScrollView refs="scrollview" ---- ><View></View><ScrollView>
 </View>)
}

Note: I am sure that no issues with imports and code. The same component is working with shallow rendering except for refs, so I have moved to 'mount'

msreddy09 avatar Nov 18 '20 15:11 msreddy09

I'd hope it's render and not reder, but either way i'd need the entirety of the component and test code. Additionally, please fill out the entire issue template; that's why it's there.

ljharb avatar Dec 21 '20 05:12 ljharb