A redux-connected component being translated into ConnectFunction ?
See original GitHub issueI have a failed unit test as below
it('contains a wallet component', () => {
console.log(app.debug());
expect(app.find('Connect(Wallet)').exists()).toBe(true);
});
Wallet.js
...
export class Wallet extends Component {
...
}
export default connect(state => ({ balance: state }))(Wallet);
App.js
import React, { Component } from 'react'
import Wallet from './Wallet';
class App extends Component {
render() {
return (
<div>
<h2>Loot Check</h2>
<hr />
<Wallet />
</div>)
}
}
export default App;
And below is the result of console.log(app.debug())
console.log src/components/App.test.js:13
<div>
<h2>
Loot Check
</h2>
<hr />
<ConnectFunction />
</div>
I don’t understand, why a redux-connected component being turned into ConnectFunction
?
API
- shallow
- mount
- render
Version
library | version |
---|---|
enzyme | ^3.9.0 |
react | ^16.8.6 |
react-dom | ^16.8.6 |
react-test-renderer | |
adapter (below) | 1.12.1 |
Adapter
- enzyme-adapter-react-16
- enzyme-adapter-react-16.3
- enzyme-adapter-react-16.2
- enzyme-adapter-react-16.1
- enzyme-adapter-react-15
- enzyme-adapter-react-15.4
- enzyme-adapter-react-14
- enzyme-adapter-react-13
- enzyme-adapter-react-helper
- others ( )
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:12 (5 by maintainers)
Top Results From Across the Web
React Redux connect(): When and how to use it
Cover when and how to use the React Redux connect() API to create container components that are connected to the Redux state.
Read more >Problems accessing Connect function value in another ...
Problems accessing Connect function value in another Component in a React-Redux App ; Can you show us how and where you use Cart...
Read more >Connect | React Redux
The connect() function connects a React component to a Redux store. It provides its connected component with the pieces of the data it...
Read more >React Tips — Mock React-Redux, Internationalization, and ...
How to Unit Test React-Redux Connected Components. We can test a React-Redux connected component by mocking the connect function and Provider ...
Read more >React-Redux - Level Up Coding - gitconnected
The connect() function connects a React component to a Redux store. ... function and by convention, it will be the first parameter of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
react-redux 6 and 7 won’t work properly with enzyme until the next enzyme release.
Just a note, you’ll have to upgrade
enzyme-adapter-react-16
as well