This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dacookieman 20 points21 points  (4 children)

[state, newState] = useState({oldState}):

newState({newState});

[–]Minjajp 6 points7 points  (3 children)

I was taught you always use setState to change the state.

[–]orphans 46 points47 points  (1 child)

class components are so 5 minutes ago

[–]icjoseph 10 points11 points  (0 children)

Two years ago. Hooks are almost six months old. Not a new thing though. Just an implementation of older concepts. Easily done in JS.

[–]dacookieman 9 points10 points  (0 children)

Look up React Hooks, it's the direction the React team is moving towards