Well, I am also using that way. But usually it looks like :
constructor -> hooks (useEffect, useCallBack... ) -> other functions
// constructorconst[foo,setFoo]=useState(null)constpathname='home'// life cycles ( hooks ), others function ( such as event handlers,... )consthandleFoo=(bar)=>{if(bar==='something'){setFoo(bar)}}useEffect=()=>{console.log(`Hello ${foo}`)},[foo]// rendersreturn(<divclassName="wrapper">{/* show stuff... */}</div>
)
I think if you're comfortable with that approach, keep it :)
i wonder what are the best way to ordering in react hooks, i came with this approach, but i don't know if are the best way...
Well, I am also using that way. But usually it looks like :
constructor -> hooks (useEffect, useCallBack... ) -> other functionsI think if you're comfortable with that approach, keep it :)
You can get more info : React Ordering