basic redux store integrated
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { LexEditor } from './LexComponents';
|
||||
import { Header, Icon, Segment } from 'semantic-ui-react';
|
||||
import { walleStore } from './WallEStore';
|
||||
|
||||
export class App extends React.Component<{}, null> {
|
||||
render() {
|
||||
return (
|
||||
<Provider store={walleStore}>
|
||||
<div>
|
||||
<Segment inverted={true} size="tiny" attached={true}>
|
||||
<Header inverted={true} color="teal" size="mini">
|
||||
@@ -16,6 +19,7 @@ export class App extends React.Component<{}, null> {
|
||||
</Segment>
|
||||
<LexEditor fileName="/new_es.xml" />
|
||||
</div>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export class LexEditor extends React.Component<LexEditorProps, any> {
|
||||
|
||||
class LexSearch extends React.Component<any, any> {
|
||||
searchType: String = 'label';
|
||||
searchValue: String = 'just';
|
||||
searchValue: String = '';
|
||||
public render() {
|
||||
let dropOptions = _.keys(fieldMetaMap).map((k, i, c) => {
|
||||
return { key: i, value: k, text: _.capitalize(k) };
|
||||
|
||||
10
src/WallEStore.tsx
Normal file
10
src/WallEStore.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { createStore } from 'redux';
|
||||
import rootReducer from './reducers/index';
|
||||
|
||||
const defaultState = {
|
||||
search: 'world'
|
||||
};
|
||||
|
||||
const devToolsKey = '__REDUX_DEVTOOLS_EXTENSION__';
|
||||
const enhancer = window[devToolsKey] ? window[devToolsKey]()(createStore) : createStore;
|
||||
export const walleStore: any = enhancer(rootReducer, defaultState);
|
||||
10
src/reducers/index.tsx
Normal file
10
src/reducers/index.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
function search(state: any = [], action: any) {
|
||||
console.log(state, action);
|
||||
return state;
|
||||
}
|
||||
|
||||
const rootReducer = combineReducers({ search });
|
||||
|
||||
export default rootReducer;
|
||||
Reference in New Issue
Block a user