What is the WordPress Interactivity API’s `wp-context` directive and how does it enable component-scoped state?

WordPress Expert Hard

WordPress Expert — Hard

What is the WordPress Interactivity API’s `wp-context` directive and how does it enable component-scoped state?

Key points

  • `wp-context` creates isolated state for each block instance
  • Child elements access and modify this state using other directives
  • Prevents pollution of global state
  • Enhances component reusability

Ready to go further?

Related questions