[wp-trac] [WordPress Trac] #45271: Can't enqueue WordPress 5.0 builtin reactjs

WordPress Trac noreply at wordpress.org
Sun Nov 4 04:26:26 UTC 2018


#45271: Can't enqueue WordPress 5.0 builtin reactjs
-------------------------------+-------------------------
 Reporter:  CantoThemes        |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  5.0
Component:  General            |     Version:  5.0
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  javascript
-------------------------------+-------------------------

Comment (by CantoThemes):

 Hello @pento

 I have loaded by hooking at returning hook from `add_menu_page()` like
 this

 {{{#!php
 <?php
 $hook = add_menu_page( $this->_page_title, $this->_menu_title,
 $this->_capability, $this->_menu_slug, $callback, $this->_icon_url,
 $this->_position );
 add_action( "load-" . $hook, [$this, 'load_assets'] );
 }}}

 If I call `wp-element`  is loading But `react` and `react-dom` is not
 loading. That's why there is error `element.min.js?ver=5.0-beta2-43859:1
 Uncaught TypeError: Cannot read property 'createContext' of undefined`.

 Create a admin page and try to load `react` and `react-dom` in the
 returning hook from `add_menu_page()`.

 Thanks

 Thanks

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45271#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list