Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Rename wp_store to something else #136

@luisherranz

Description

@luisherranz

We've wanted to find a better name for what we've been calling wpx() for a while, and @michalczaplinski just suggested using store():

// render.php
<?php
store([
  "state" => [
    "isOpen" => false
  ]
]);
?>

<div>
  <button data-wp-on:click="actions.toggle">Toggle</button>
  <div data-wp-show="state.isOpen">
    Some text...
  </div>
</div>
// view.js
import { store } from '@wordpress/interactivity';

store({
  actions: {
    toggle: ({ context }) => {
      context.isOpen = !context.isOpen
    },
  },
});

I'm not sure if the WordPress community would accept such a generic name, but I like it because it is explicit, and if we can, I'd prefer to avoid more than one word to avoid the camelcase vs snakecase confusion. I.e., addStore vs add_store.

Any thoughts? Other ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions