<my-ce name="Initial Name"></my-ce>

<script>
  class MyCe extends HTMLElement {
    constructor() {
      super()
      this.textContent = 'Hello, World!'
    }
    static get observedAttributes() {
      return ['name']
    }

    attributeChangedCallback(name, oldValue, newValue) {
      if (name === 'name') {
        this.textContent = newValue
      }
    }
  }
  customElements.define('my-ce', MyCe)
</script>

React to attribute changes

When the name attribute changes, the attributeChangedCallback method is called which gives you a chance to update your state or template.