score:6
Accepted answer
straight from redux documentation about testing connected
components:
in order to be able to test the app component itself without having to deal with the decorator, we recommend you to also export the undecorated component:
import { connect } from 'react-redux' // use named export for unconnected component (for tests) export class app extends component { /* ... */ } // use default export for the connected component (for app) export default connect(mapstatetoprops)(app)
then you do just as you expected:
import connectedapp, { app } from '../app';
Source: stackoverflow.com
Related Query
- import connected and disconnected components React, Redux
- How to import and export components using React + ES6 + webpack?
- No need for state in React components if using Redux and React-Redux?
- Decoupling React Components and Redux Connect
- React components lifecycle, state and redux
- Sync queryParameters with Redux state and react router for function components
- Import fonts to react project with webpack and styled components
- Dynamic Import and Lazy load React Components
- How to properly store React components in separate files and import React?
- Import css files and react components in a create-react-app application?
- How action and reducers are connected with each other in react redux
- Using Jest and Enzyme to test functional React components that are using Redux
- Nesting connected redux containers and presentational components in typescript
- How to import components in React and edit them (Change their State)
- React router NavLink activeClassName does not work with redux and styled components
- How to maintain action creator types in connected components with Redux, React and TypeScript?
- Re-render all components in React and Redux
- React Redux components with REST Endpoints and reusable components
- How can I pass arguments in action different 3 level react components without redux and context API?
- Components not having the expected props, while React and Redux Dev Tools are having the expected States and Props
- React Redux, my component is not connected to Redux Store. I tested the action and reducer in another component, it does work for other components?
- React hooks, function components and Redux
- more components connected to redux or less? react
- Can't figure out how to pass props to components when using React Router v5 and Redux
- What are React controlled components and uncontrolled components?
- Difference between component and container in react redux
- How to render react components by using map and join?
- React / Redux and Multilingual (Internationalization) Apps - Architecture
- Difference between import React and import { Component } syntax
- How to import CSS modules with Typescript, React and Webpack
More Query from same tag
- Is there a way to traverse tree built by React?
- How to not overwrite dispatch with blank state
- Is it possible to declare generics react functional components using typescript?
- setState(...): This usually means you called set state() on an unmounted component
- Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}' - React Anagram
- How to properly set state from if statement
- Fetch Requests in different pages with React Hooks
- enable dragging of element in a ScrollView after long press
- Warning: Each child in a list should have a unique "key" prop. Key prop doesn't show when inspect element
- audio tag not working in ReactJS application deployed in AWS Amplify
- Why does test for Conditional Rendering not fail?
- How can I make the function halt execution for n seconds in react js?
- How to use react hook useeffect with adding event-handler depended on state?
- mobx with react store not reflected in observer
- How do you add the onClick handle on each object?
- Ant Design: How to pass this.props.form to children
- Extracting json from an array
- Error: spawn cmd ENOENT while starting React APP
- XMLHttpRequest cannot load http://localhost:5000/api/users/signup due to access control checks
- Page tries to render before data is loaded from API - React
- Designinig SASS I want Box layout but not able to get it
- How to detect page scroll to top in React.js?
- React changing props on grandchildren: object is not extensible / tree traversing react children
- How to loop through an array with keys and values in to send a request for Axios.get's params in ReactJS?
- UseEffect being called multiple times
- TypeError: this.props.getRecipes is not a function
- Referencing outdated state in React useEffect hook
- React Component Props typed with two Omit<...> | Omit<....> throwing TS error 2339. Property x does not exist on Pick | Pick
- function is running before my redux state is available, TypeError: Cannot read properties of undefined (reading 'find')
- How can I show the button only when the mouse hovers on the color?