const Map = compose(
withStateHandlers(() => ({
isOpen: false,
markerIndex: 0
}), {
onToggleOpen: ({ isOpen }) => (index) => ({
isOpen: true,
markerIndex: index
})
}),
withScriptjs,
withGoogleMap
)
I want to call the onToggleOpen in another class, is there anyway to do it?
You can extract onToggleOpen
into a function, and export it to use in another file.
const onToggleOpen = ({ isOpen }) => index => ({
isOpen: true,
markerIndex: index
});
const Map = compose(
withStateHandlers(() => ({ isOpen: false, markerIndex: 0 }), {
onToggleOpen
}),
withScriptjs,
withGoogleMap
);
// ES6 module syntax
export { onToggleOpen };
// CJS syntax
modules.exports = { onToggleOpen };
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.