Karthik Kalyanaraman
1 min readSep 29, 2019

--

Nice post! I would like to point out that state in react can also be an object defined in the parent component. Usually the state of the entire app lives at the parent component. Hooks is the latest addition to make it flexible for certain use cases where we don’t need a special state variable declared at the parent component just to use it inside a child component deep down somewhere. So a better comparison would be between the actual state object of React with Vues data object.

Also, personally I think Vue gives you more flexibility for managing data than you need. For instance you can pass data around by emitting and listening across components. While this may be useful, it can also lead to bugs that are hard to debug. In React, data is passed from parents to children via props and from children to parents via callbacks. This is more of a stricter design where communication is only from top to bottom or the other way round(although hooks may help with passing data between children). Also it’s a common pattern to keep state at the top parent component(lifting the state up) and manage them from one place. While I don’t have a preference of one framework over the other, it’s worth pointing out these differences in this post.

--

--

Karthik Kalyanaraman
Karthik Kalyanaraman

Written by Karthik Kalyanaraman

Software Engineer | Curious about technology and the economics of the tech industry | https://twitter.com/karthikkalyan90

No responses yet