Custom plugin with Gutenberg and external React libraries
-
Hi, I am new to the WordPress world. Sorry if this is silly, trivial or a misunderstanding of Gutenberg capabilities . I’ve been working with JS+React.
I am trying to port a custom calculator from a React project to a new plugin created with Gutenberg Create Block Starter project
I am trying to use Material-UI and formik inside the plugin, but it’s not working, is it possible to do this? So far I’ve tried installing with node_modules and also with a single minified file.
Also, I need to retrieve data from a graphql end point. Would it be possible to use JS libraries like graphql and graphql-request? Any tips on this?function testcalculator_test_calculator_block_init() { register_block_type_from_metadata( __DIR__ ); // wp_enqueue_script( 'material-ui.js', 'node_modules/@material-ui' ); wp_register_script( 'material-ui', plugins_url( 'material-ui.js', __FILE__), ); } add_action( 'init', 'testcalculator_test_calculator_block_init' ); add_action( 'wp_enqueue_scripts', function() { wp_enqueue_script( 'material-ui' ); }); // load qrcode on editor screen so we can trigger // and show the qrcode within the editor add_action( 'admin_enqueue_scripts', function() { wp_enqueue_script( 'material-ui' ); } );
`
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom plugin with Gutenberg and external React libraries’ is closed to new replies.