0.0.9 • Published 4 years ago

@hamworks/wp-data v0.0.9

Weekly downloads
6
License
GPL-3.0+
Repository
github
Last release
4 years ago

@hamworks/wp-data

Installation

Install the module

npm install @hamworks/wp-data --save

API

useMeta

React hooks for post meta.

Parameters

  • key string: The post meta key.

Returns

  • any, Function

    • any: A post meta value.
    • Function: Update function for meta value.

Examples

jsx
import { TextControl } from '@wordpress/components';
import { useMeta } from '@hamworks/wp-data';

const FooControl = () => {
	const [ foo, setFoo ] = useMeta( 'foo' );
	return <TextControl label="Foo" type={ 'text' } onChange={ setFoo } value={ foo } />;
};
tsx
import { TextControl } from '@wordpress/components';
import { useMeta } from '@hamworks/wp-data';

const FooControl = () => {
	const [ foo, setFoo ] = useMeta<string>( 'foo' );
	return <TextControl label="Foo" type={ 'text' } onChange={ setFoo } value={ foo } />;
};
0.0.9

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago