SHARE
TWEET

Untitled

a guest Dec 29th, 2016 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const mapStateToProps = state=>{
  2. console.log(state);  // this 'state' return undefined.
  3. return {
  4. loginform: state
  5. }};
  6.  
  7. export default connect(mapStateToProps)(LoginForm)
  8.    
  9. let store = createStore(showUsername,
  10. window.devToolsExtension && window.devToolsExtension() );
  11.  
  12. ReactDOM.render(
  13. <Provider store={store}>
  14. <Router history={browserHistory}>
  15.     <Route component={AppNavBar}>
  16.         <IndexRedirect to='/login'>
  17.         <Route path='/login' component={LoginForm} />
  18.     </Route>
  19. </Router>
  20. </Provider>
  21. ,
  22. document.getElementById('root')
  23. );
  24.    
  25. class LoginForm extends Component {
  26.     ...
  27. }
  28.  
  29. const mapStateToProps = state=>{
  30. console.log(state);  // this 'state' return undefined.
  31. return {
  32.     loginform: state
  33. }};
  34.  
  35.  
  36. export default connect(mapStateToProps)(LoginForm)
  37.    
  38. export const showusername = 'showUsername';
  39.  
  40. export const showUsername =(username,index)=>{
  41. console.log(username,index);
  42. return{
  43.     type:showusername,
  44.     username,
  45.     payload:index
  46. }
  47.  
  48. };
  49.    
  50. const initialState = {
  51.         username: '',
  52.         password: '',
  53.         submit: false,
  54.         //request: 'self',
  55.         showselectfield: false
  56.     };
  57.  
  58. export default function showUsername(state = initialState, action) {
  59. switch (action.type) {
  60.   case type.showusername:
  61.   return (
  62.       Object.assign({},initialState ,{username:action.username,password:action.password})
  63.       );
  64.  
  65. default:
  66.   return state
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top