RosettaJS: Comparativas de Vue, React y Angular

View Logic

Dynamic Property Binding

Dynamic property binding connects application values with HTML element properties to keep the interface updated when those values change.

Example

Controlling whether a button is disabled with a variable.

Vuev-bind

<script setup lang="ts">
import { ref } from 'vue'

const isDisabled = ref(true)
</script>

<template>
  <button :disabled="isDisabled">Save changes</button>
</template>

Prefixing the property name with : is the shorthand for using the v-bind directive.

ReactJSX expressions

import { useState } from 'react'

function ProfileForm() {
  const [isDisabled] = useState(true)

  return (
    <>
      <button disabled={isDisabled}>Save changes</button>
    </>
  )
}

In JSX, a property value is written in curly braces to evaluate a JavaScript expression.

Angularproperty binding

import { Component, signal } from '@angular/core'

@Component({
  selector: 'app-profile-form',
  standalone: true,
  template: `
    <button [disabled]="isDisabled()">Save changes</button>
  `,
})
export class ProfileFormComponent {
  isDisabled = signal(true)
}

Wrapping a property name in square brackets creates a property binding.