reactjs - Exporting Constants -
i have 1 file called types. contains following.
export default { clear_state: 'clear_state' };
i want import clear_state, destructured import in other file.
import { clear_state } './types';
this won't work in react native, work in regular react. there way make work in react native, or not possible?
the syntax same both react & react native. looks similar destructuring, it's not quite same.
you exporting object default export, this:
import types './types' const { clear_state } = types
or export clear_slate
named export instead of default:
export const clear_slate = 'clear_slate' // or const clear_slate = 'clear_slate' export { clear_state }
then import name:
import { clear_slate } './types'
Comments
Post a Comment