function setup():React.Component{
class Root extends Component {
constructor() {
super();
this.state = {
isLoading: false,
store: configureStore(() => this.setState({ isLoading: false })),
};
}
render() {
return (
<Provider store={this.state.store}>
<App />
</Provider>
);
}
}
return Root;
}
Ковырялся в одном проекте `React-Native`
И заметил вот такую конструкцию
Что это?
Вот еще кусочек нашел
import type { Action } from '../actions/types';
import { OPEN_DRAWER, CLOSE_DRAWER } from '../actions/drawer';
export type State = {
drawerState: string,
drawerDisabled: boolean
}
const initialState = {
drawerState: 'closed',
drawerDisabled: true,
};
export default function (state:State = initialState, action:Action): State {
if (action.type === OPEN_DRAWER) {
return {
...state,
drawerState: 'opened',
};
}
if (action.type === CLOSE_DRAWER) {
return {
...state,
drawerState: 'closed',
};
}
return state;
}