In both cases where I illustrated useConstructor, it was defined above the App function.
useConstructor
App
Yeah it's where you defined it that i don't quite understand and it throws errors for me. "Const declarations' require an initialization value."
Your one has:
const useConstructor(callBack = () => {}) {
Should it not be this? (which works)
const useConstructor = (callBack = () => {}) => {
I'm not trying to nitpick... i'm just uncertain of my own knowledge and the ever changing landscape of javascript.
Ahhh, yes. Good catch. I am missing the =>. Obviously, I didn't actually run these examples. I just typed them out. Thanks!
=>
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In both cases where I illustrated
useConstructor
, it was defined above theApp
function.Yeah it's where you defined it that i don't quite understand and it throws errors for me. "Const declarations' require an initialization value."
Your one has:
Should it not be this? (which works)
I'm not trying to nitpick... i'm just uncertain of my own knowledge and the ever changing landscape of javascript.
Ahhh, yes. Good catch. I am missing the
=>
. Obviously, I didn't actually run these examples. I just typed them out. Thanks!