JavaScript for WordPress Forums React Explained Refactoring stage issues Reply To: Refactoring stage issues

#107528
GPorter43
Participant

the getNewSlugFromTitle function/method does not appear to be passing the converted slug to the save.post function/method.

i changed the code in the book from


getNewSlugFromTitle = (title) => {
encodeURIComponent(
title
.toLowerCase()
.split(" ")
.join("-")
);
}

to


getNewSlugFromTitle = title => {
    return encodeURIComponent(
      title
        .toLowerCase()
        .split(" ")
        .join("-")
    );
  };

and it seems to have fixed it, yet it worked when it was in the App.js, is that beacuse one is a class and the other is pure js