Questions tagged [react]
The react tag has no usage guidance.
14
questions with no upvoted or accepted answers
1
vote
0
answers
27
views
configure additonal build files in the @wordpress/create-block
I'm using the @wordpress/create-block package to create my block plugin. It comes with preconfigured webpack settings to build all the assets. By default as js in the src/ folder is built in the build/...
1
vote
0
answers
163
views
useBlockProps() nests wrapper with class name inside block wrapper in the editor
I'm trying to add a tailwind class to the block wrapper of a custom block I'm developing.
However, useBlockProps({className: 'h-full'}) generates an additional wrapper with the tailwind class name ...
1
vote
0
answers
83
views
How to add more elements to an already existing <PanelBody> section in Gutenberg
I am filtering core blocks to add more functionality and I know how I can create a new section in the sidebar that is opened by default like this:
return (
<>
...
0
votes
0
answers
67
views
Gutenberg block: add a multi-select for posts
I created a custom Gutenberg block with @wordpress/create-block.
I now have a dropdown where you can select a post, but I would like this to be a multi-select where you can select multiple posts. How ...
0
votes
0
answers
35
views
Force-update the meta variable first set using `var [ meta, setMeta = useEntityProp( 'postType', postType, 'meta' );`
Context: I've got a plugin that triggers some actions when a post is saved, like contact an external API and save the result as a custom field. All of this happens in the background, using PHP and the ...
0
votes
0
answers
23
views
How to access WP header from Appearance > Header using WP Rest api (React)
Need to use the WordPress Header Section in react js. No plugin is used for plugin it is by default.
0
votes
0
answers
41
views
WP Rest-API response is unauthorized (React)
I am using trying to fetch data from wp to react via rest api.
There are two API's I am working upon. First one is wp/v2/pages is working fine (With credentials it is authorized) but,
Second api wp/v2/...
0
votes
0
answers
36
views
Cannot call a class as a function in block plugin react component
I'm developing a block plugin and working with the React packages for WordPress.
In my Save function I'm trying to load a slider component from the package ['react-slick'] (https://github.com/akiran/...
0
votes
0
answers
30
views
How to dynamically add style tags to Gutenberg editor in react
Is there any way to add a dynamic style tag to the editor content area by react. The inner content will change by editing. Is any component or hook can use?
0
votes
1
answer
284
views
How can I include React useState in a custom gutenberg block plugin?
The block code is as such:
wp.blocks.registerBlockType('myblocks/gallery', {
title: 'Gallery',
icon: 'my-gallery',
category: 'common',
attributes: {
},
edit: props => {
const [...
0
votes
0
answers
73
views
How do i fix type error
i an getting an error in my react build online, even though it seems to be working fine locally.
react-dom.production.min.js:189 TypeError: Cannot read properties of undefined (reading 'length')
at VK ...
0
votes
2
answers
81
views
Why is my Toggle field not showing in Gutenberg?
I am adding a PluginSidebar to Gutenberg and it works until I try to add a meta field to the sidebar. Then it doesn't work. I'm not sure why though.
import { registerPlugin } from "@wordpress/...
0
votes
0
answers
405
views
What is the proper way of using React Hooks in Gutenberg on frontend?
I'm mostly interested in useState. It works fine in edit.js, but in save.js it just breaks and it throws the minified React error, see below:
I tried creating a separate .jsx component file but it ...
-1
votes
0
answers
17
views
Rest API working in Postman but not on React Native android
My WordPress REST API returns HTML, that has been working perfectly fine on Postman but in React Native mobile app, PHP variables are empty (the variable that contains value from Database), even ...