Declarative and imperative in React.js
A declarative way allows you to control flow and specify how it should look at your application. The imperative style allows you to control your application by instructing it on what it should do. If we look into the benefits of declarative style, it does not make you slow down in the implementation details of representing the state. You are assigning the organizational component of keeping your application views consistent so you have to worry about state. In an imperative way, you have to give the instructions step by step. For example, you are going out shopping for the house party you are hosting. Your home is all messed up. Your child is at home. You are giving him instructions on how to clean the home.
In an imperative way it will look like this:
Go to the kitchen.Get the garbage bag.
Dump it in the trash can.
Vacuum the living room.
…
Vacuum whole house.
In a declarative way it will look like:
Clean the whole house.
Comments
0 comments
Please Sign in or Create an account to Post Comments