Previous proposalPersisting Data Across System
React Code In Imperative Style!
In React, component are self managed entity. The React way of controlling behvaiour of a component is using “props” in a declaraive fashion. And 99.99% of the time “declarative” approach works fine. But there can be a case in which we want to control internal of a component like manage its state or call its method. In this talk I will be talking about the rare 0.01% case(but important) in which we write code in imperative style and benefits of it.
Components are first class citizens in React and they are independent of each other. By independent I mean they are self managed entity, they have their own state and logic. In react project, components are arranged in a tree structure. So only way parent component can ask child component to do something is by passing props to it. Which is declarative way of writing code. And this is how code should be written in React.
But there are some rare case in which we need to write imperative style of code. i.e instead of just passing props, we want to call internal methods and manage component’s state. React “Refs” are the way of doing this. In this talk I will be talk about those rare case and analyse how good/bad it can be.
Basic Knowledge on React.
I am software consultant from Pune. I mostly work in Rails and React. Co-Organiser and regular speaker at ReactJS pune meetup.