Port updateComponent() to JavaScript