Namespace your flux action types to prevent collisions:
function constants(namespace, constants) {
return Object.freeze(
constants.reduce((obj, constant) => {
return {
...obj,
[constant]: `${namespace}/${constant}`
}
}, {})
)
}
const articleActions = constants('articles', ['FETCH', 'FETCH_SUCCESS', 'FETCH_ERROR'])
const authorActions = constants('authors', ['FETCH', 'FETCH_SUCCESS', 'FETCH_ERROR'])
console.log(articleActions.FETCH) //'articles/FETCH'
console.log(authorActions.FETCH) //'authors/FETCH'
for eslint "no-shadow" (constants declared in upper scope)