DEV Community

Abdallah hamouda
Abdallah hamouda

Posted on

How I learned React in one Week as a vue developer

first to get a bit of understanding to my background I worked with Vue for more than 3 years so I got bored of it a little bit and I wanna made a new portfolio so I decided to pick react, react router and react material

1- Change your mindset Vue is separated to

HTML, Style Script
but React or JSX is HTML inside JavaScript you literally code inside JavaScript Function with a return () like this
you can write methods or the equivalent is normal arrow function above the return
you can bind data {} single bracket and v-model is the same and
the props is passed on the functions
in the end you should export default the function

`import {useState, useEffect} from 'react'
const MyFunction = ({myProp})=>{
const myMethod = ()=>{
console.log("working react method")
}
return(
<div>
<h1>working {myPorp}</h1>
</div>
)
}
export default MyFunction
Enter fullscreen mode Exit fullscreen mode

`

2- Learn Hooks

I just used useState and useEffect basically useEffect is the same as mounted in vue
useState is to change the value of the variable this is way more different than anything in vue
useState
first you have to declare a variable but not the normal way you declare
let [variableName, ChangeFunction] = useState('your Value')

then you can change it by ChangeFunction(variableName = 'my new Value')

that's it is react from a vue developer perspective I am still learning it and I really love it I will follow this roadmap
https://roadmap.sh/react

if you wanna see my project I developed in react
www.hamouda.tk
still have room to work and improvement but I like to share my progress with you
thanks for reading please tell me if there is something I missed

Top comments (0)