I think I understand useSelect, (basically). For example:
const slug = useSelect(
( select ) => select( 'core/editor' ).getEditedPostSlug()
);
Will get the slug and set up a subscriber to the store so that if the value is changed slug will update and the the component will re-render?
But, I also have this:
const [ meta, setMeta ] = useEntityProp( 'postType', 'kea_activity', 'meta' );
This gets me the meta data from the store and a setter. Good.
If I use the setter to update the meta data it seems my component rerenders. I says seems because I am assuming that this is what is causing the rerender. I am pretty sure it is this. So - this implies that something is listening for updates to the meta data and rerendering when this changes. What is this "something"?
Thank you.
I think I understand useSelect, (basically). For example:
const slug = useSelect(
( select ) => select( 'core/editor' ).getEditedPostSlug()
);
Will get the slug and set up a subscriber to the store so that if the value is changed slug will update and the the component will re-render?
But, I also have this:
const [ meta, setMeta ] = useEntityProp( 'postType', 'kea_activity', 'meta' );
This gets me the meta data from the store and a setter. Good.
If I use the setter to update the meta data it seems my component rerenders. I says seems because I am assuming that this is what is causing the rerender. I am pretty sure it is this. So - this implies that something is listening for updates to the meta data and rerendering when this changes. What is this "something"?
Thank you.
Will get the slug and set up a subscriber to the store so that if the value is changed slug will update and the the component will re-render?
That is correct