There are two steps. Firstly, you bind an object to a function and then you reference it using this. To see that, you need to create two fresh objects which are representing an XY coordinate. After that, you’re going to create a function that’s going to print out. Basically just XY coordinate but you can use this function for both objects without using an argument. So we can do this with the bind method. You need to define the function and then this will take as I said no arguments for no parameters inside here, it’s going simply just console. And now you need to bind one of these objects to this function and then call it. So it all works nicely and smoothly.
We bind an object to a function, including it to a function and then referencing it using this keyword. Essentially this is going to change depending on the context and the bind argument.
Understand the one way data binding!
The structure of ReactJS is easier to a developer. You write it and you know it. It’s a lot more understandable (than AngularJS for example) about where the data is flowing and how it’s getting around. Data binding is one way, which means fewer unwanted spillover effects. Data binding is a feature that allows you to synchronize data between the state (model) of the application and the view.
In one-way data binding, any change in the state of the application automatically updates the view. In contrast, two-way data binding binds together properties and events under the same object, that is, any modification to the model updates the view and vice versa. In React, properties are passed from parent to child components, which is called unidirectional data flow, or top to bottom.
The component state is encapsulated and not available to other components unless it is passed to the child component as props, i.e. the component state becomes the child component’s props. But what if you need to propagate data through a component tree? This is done through child events and parent callbacks. The React documentation includes a great model that explains such a scenario. One way data binding makes it much simpler to parse code and find the root cause of problems.