Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newest version of redux-form makes tutorial impossible to continue. Advanced Redux - Clientside Auth Section 7, Lecture 94 at 10 minutes #6

Open
ghost opened this issue Jan 22, 2017 · 12 comments

Comments

@ghost
Copy link

ghost commented Jan 22, 2017

For anyone stuck on Advanced Redux - Clientside Auth Section 7, Lecture 94 at 10 minutes, here's a fix that will let you move on.

Issue: There's no way to move forwards from this part of the Client Side Auth lecture as latest updates to reduxForm mean signinUser (and other variables) doesn't get passed to props. You'll probably also notice before then that email and password can't be console.logged from your handleFormSubmit function either.

Hitting the Sign Up button will throw Uncaught TypeError: this.props.signinUser is not a function(…)

Fix: A quick fix, though not ideal, is to open package.json and change the redux-form dependency to version 5.3.3. This will let you continue.

"redux-form": "5.3.3",

http://stackoverflow.com/questions/41138158/uncaught-typeerror-this-props-signinuser-is-not-a-function

@StephenGrider fyi

@crisryantan
Copy link

crisryantan commented Feb 20, 2017

Thank you for this. I was wondering why I also could not console.log email and password. Hopefully the course would be updated using the latest redux-form library.

@paolavness
Copy link

paolavness commented Feb 22, 2017

Disappointing about this.... Would have been great to know about this earlier. Do you have a planned update? The course was helpful but alot of energy spent (wasted?) which could have been dedicated to learning the latest version, not an old version. Latest version is already 6.5.

@StephenGrider
Copy link
Owner

Hey guys - I was under the impression that I had mentioned a specific version of redux-form to use in the course. Is that not the case?

@ghost
Copy link
Author

ghost commented Feb 22, 2017 via email

@paolavness
Copy link

Thank you for replying Stephen. For user's like myself, I'm not using the boilerplate but integrating directly into a project as I learn. It needs to be visible somewhere else - or ideally, updated :)
Warmly,
Paola

@hanorine
Copy link

If anyone is still interested in getting an upgrade to v6.5.0 i have managed to work it all out and you can check it out in my repo here.

If it helps you or if you like the successful implementation, give the repo a star.
cheers

@paolavness
Copy link

Awesome @JaysQubeXon, thank you!!

@muhammed-salman
Copy link

I have updated the code to used redux form v7 and issued the pull request for same. You can check out my repo for implementation https://github.com/muhammed-salman/react-auth-client

@SunnyJohal
Copy link

@StephenGrider you did not mention a specific version in your course. A note for people taking the course in future would probably be handy. Cheers

@Haack79
Copy link

Haack79 commented Oct 20, 2017

you did mention it in a video about keeping to an older version but it's not specifically clear how to keep that older version when the newer version seems to be automatically loaded.

@padrisimo
Copy link

padrisimo commented Dec 20, 2017

Guys you just have to swamp a few things to move on, its easy to find out reading the documentation of redux-form but basicly we implement connect from react-redux an then connect the signin component, u may use Field insted of input in the component and give it a name and finally pass values as param of ur actions in this way (for lesson 94 signin.js file ) :

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Field, reduxForm } from 'redux-form';
import * as actions from '../../actions';

class Signin extends Component {
    handleFormSubmit(values) {
        this.props.signinUser(values);
    }

    render() {
        const { handleSubmit } = this.props;

        return (
            <form onSubmit={handleSubmit(this.handleFormSubmit.bind(this))}>
                <fieldset className="form-group">
                    <label>Email:</label>
                    <Field component="input" type="email"name="email" className="form-control" />
                </fieldset>
                <fieldset className="form-group">
                    <label>Password:</label>
                    <Field component="input" type="password" name="password" className="form-control" />
                </fieldset>
                <button action="submit" className="btn btn-primary">Sign in</button>
            </form>
        );
    }
}

export default reduxForm({
    form: 'signin'
})(
    connect(null, actions )(Signin)
);

in ur actions (index.js) file we can select the email and password in this way:

import axios from 'axios';

const ROOT_URL = 'http://localhost:3090';

export function signinUser( values ) {
    const { email, password } = values;
    return function(dispatch) {
        axios.post(`${ROOT_URL}/signin`, {email, password})
    }
}

Everything must work in this way, I highly recomend to use redux-logger and implement it as middleware (in the same way we did in the course with redux-thunk) because is very important to know whats going on with ur state and what dispacth ur actions in development other wise is kind of blind.

@padrisimo
Copy link

by the way install an older version is as simply as npm uninstall redux-form and then npm i -S redux-form@numberofversionyouknowitworks but ...
My experience in life when I have to deal a legacy projects with backbone, marionnet, jquery, handlebars and all of this if the versions are not fixed in the package.json there is allways trouble so thats why is really important to fix versions of your dependemcies BUT anyway if you are working in really old projects you may change your node and npm version with a node versions manager and development mades you feel like an amish so my humble advise is much as you can TRY TO NOT USE OLDER VERSIONS, TRY TO UPDATE YOURSELF and ur development to the latest stable versions of what u use.

sorry 4 my english and greeting from Barcelona :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants