ionic-team/stencil-site

forceUpdate in documentation

Slevinski opened this issue · 1 comments

With v3, it seems forceUpdate has been mostly removed from the documentation.

I did find it on https://stenciljs.com/docs/api#other but the documentation is sparce.

I'm not sure the best update to the documentation, but two points should be made.

  • In order to use forceUpdate in a component, you need to import it from @stencil/core.
  • In order to call forceUpdate on a component, you need to pass it a reference to a node or element.

For a class component, I used something like the following.

import { Component, forceUpdate } from '@stencil/core'

// inside a class component function
forceUpdate(this);

I know that forceUpdate isn't the best solution for production, but it is useful in development and testing.

Thanks! I've labeled this for the team to look into