You can destructure when the export
is an object.
// file1.js
export { foo, bar };
// index.js
import { foo } from './file1';
I often find myself puzzling over the best ways to fetch data with React based on whether the app is universal, has Redux, etc. This is an attempt to summarize it all.
Use redial and redux-thunk. The fetch
function that decorates the route-handling component should dispatch all data-fetching actions for Redux containers nested in the route. Additional uses of route-specific information (query parameters) can be accessed by sending those props in via mapStateToProps
.
From what I can tell, there's no agreed-upon way to do this yet. However, react-router-config is in development to address this scenario. Also, redux-first-router might be helpful. And [Apoll