class Test extends Component {
render() {
return (
);
}
}
const mapDispatchToProps = dispatch => ({
});
const mapStateToProps = state => {
return {};
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(Test);
I got a component like this above. I am trying to export it from another file say (index.js) in the below fashion.The path is correct i have checked that.
export Test from "./test.jsx";
But connected component is not getting exported from this file. Am I doing something wrong ? If i am exporting the class and importing it like the following its working
export {Test} from "./test.jsx";
Try to change this code line below
export Test from "./test.jsx";
Into
export { default } from "./test.jsx";
https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export
Have you tried this?
import Test from "./test.jsx";
export Test;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.