Enzyme: React 16: _instance._instance not present on shallow render

Created on 14 Jun 2017  路  3Comments  路  Source: enzymejs/enzyme

const wrapper = shallow(<Component />)
console.log(wrapper.instance()) // undefined
console.log(wrapper.renderer._instance) // correctly logs the instance
console.log(wrapper.renderer._instance._instance) // undefined

This is using React Native 0.45.1, and React 16.0.0-alpha.12. Is it possible that React has changed its instance structure in v16?

Most helpful comment

I wholeheartedly agree.

All 3 comments

Not just possible, they did.

Enzyme however does not yet support react 16, because it doesn't exist yet - and we don't support alphas. npm ls shouldmbe erroring for you right now.

928

Fair enough, it's unfortunate that they made 16 the default version of react in the latest stable version of react native!

I wholeheartedly agree.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AdamYahid picture AdamYahid  路  3Comments

timhonders picture timhonders  路  3Comments

abe903 picture abe903  路  3Comments

modemuser picture modemuser  路  3Comments

amcmillan01 picture amcmillan01  路  3Comments