After hours of reading blog posts, I understand that React has one-way data binding, and Angular has two-way. But I don't actually know what that means....
React
import { useState } from 'react';
import Switch from "./switch";
function App() {
const [value, setValue] = useState(false);
return (
<Switch
isOn={value}
handleToggle={() => setValue(!value)}
/>
);
}
Angular
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: `
<switch [ngModel]="value" (ngModelChange)="value = $event"></switch>
`,
})
export class AppComponent {
value = false;
}
Those look functionally identical to me.
Can someone help explain the difference?