1 year 6 months ago

React setState asynchronous behaviour

Many frontend developer using react.js do not realize this initially, but setState is asynchronous. If you set some state in a child component and want to use its state in its parent component then there is possibility that you will see always old state data and the component will retrieve previous value of state. This is because setState has not done its job yet when it was invoked again.  This is the trickiest part of setState.
1 year 7 months ago

Best Practices for Writing React Components

I remember when I started writing React components; I saw so many different approaches to write React Components in lots of trainings. Today the Reactjs framework has matured significantly but we still see different approach to write React Component. For my existing react application I have spent more than seven months to write react components and experienced different approaches within my team and now we feel in a good state with our existing practices. Here I would like to share our best practices. I hope this will be beneficial for beginner or experienced.