First of all, sorry for the redundant question, just haven't found a proper way to ask this. I was checking out a video for protecting routes using React-router when the dude in the video wrote something like this:
class Auth {
constructor() {
this.authenticated = false;
}
login(cb) {
this.authenticated = true;
cb();
}
logout(cb) {
this.authenticated = false;
cb();
}
isAuthenticated() {
return this.authenticated;
}
}
Here's the bit that's confusing me:
login(cb) {
this.authenticated = true;
cb(); // What syntax is this???
}
What does this do exactly do? Is it supossed to take a function as an argument call her? Thanks for your help in advance!