Title: reactPress not defined
Last modified: May 20, 2023

---

# reactPress not defined

 *  Resolved [hammaadmemon](https://wordpress.org/support/users/hammaadmemon/)
 * (@hammaadmemon)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/reactpress-not-defined/)
 * I’m working through the getting started tutorial and am having trouble with the“
   Using the REST API” step. I’m getting the error reactPress is not defined in 
   api.js when opening the page on localhost.
 * I tried building and viewing the app on the Local WP server but that also fails
   and gives me an obscure error (since the code is minified after build).
 * Here is the tutorial that I’m following: [https://rockiger.com/en/reactpress/reactpress-tutorial/](https://rockiger.com/en/reactpress/reactpress-tutorial/)
 * Do I have to import the reactPress variable somehow? It’s supposed to be global
   but doesn’t seem to be accessible from any .js file in src.
 * Any help would be appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [rockiger](https://wordpress.org/support/users/rockiger/)
 * (@rockiger)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/reactpress-not-defined/#post-16759939)
 * Could you look into the content of the `index.html`? And search for `var reactPress`?
   It should be defined there.
   If not look at the source of your WordPress page 
   where you want to embed the React app. Is it present there?
 *  [juust](https://wordpress.org/support/users/juust/)
 * (@juust)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/reactpress-not-defined/#post-16790640)
 * Hi [@rockiger](https://wordpress.org/support/users/rockiger/) [@hammaadmemon](https://wordpress.org/support/users/hammaadmemon/),
   I ran into the same problem.
 * The ReactPress global var is not set in the dev-environment. You should be able
   to set it in the plugin admin screen on the WordPress install, but that doesn’t
   work for me. I assume that is because I work on a Windows machine.
 * The reactpress var is however still set in the production environment on my install,
   so it runs on WordPress once you build it.
 * If you have other causes or solutions, I would love to hear it.
 *  Plugin Author [rockiger](https://wordpress.org/support/users/rockiger/)
 * (@rockiger)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/reactpress-not-defined/#post-16806018)
 * [@juust](https://wordpress.org/support/users/juust/) Thanks for posting this.
   I have unfortunately now Windows system where I can debug problems.
 * A casual solution would be to a set the `reactPress` var by hand in the `index.
   html`. The drawback of this approach is, that you have to repeat it every time
   you update the the dev environment from ReactPress.
 *  [juust](https://wordpress.org/support/users/juust/)
 * (@juust)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/reactpress-not-defined/#post-16806290)
 * Thanks for the reply [@rockiger](https://wordpress.org/support/users/rockiger/).
 * Once I added a second and third appdirectory and page, it did allow me to set
   the index.html var.
    -  This reply was modified 2 years, 11 months ago by [juust](https://wordpress.org/support/users/juust/).

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘reactPress not defined’ is closed to new replies.

 * ![](https://ps.w.org/reactpress/assets/icon-256x256.png?rev=2471443)
 * [ReactPress - Create React App for Wordpress](https://wordpress.org/plugins/reactpress/)
 * [Support Threads](https://wordpress.org/support/plugin/reactpress/)
 * [Active Topics](https://wordpress.org/support/plugin/reactpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/reactpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/reactpress/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [not defined](https://wordpress.org/support/topic-tag/not-defined/)

 * 4 replies
 * 3 participants
 * Last reply from: [juust](https://wordpress.org/support/users/juust/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/reactpress-not-defined/#post-16806290)
 * Status: resolved