There is one global js variable ‘reactPress’. It has two properties user
and usermeta
.
If the user is logged in, the holds the user data, otherwise, they are empty.
Hi! Thanks for the answer, but how do I access the variable? Something like process.env.reactPress?
thanks!
@rockiger
I am using windows.reactPress
on react app but I got an undefined value, can you please help me with anything I need to do to get a WordPress user id on reactPress app?
See this screenshot https://prnt.sc/WUNMSsu-PX73
-
This reply was modified 2 years, 3 months ago by Mahesh Patel.
-
This reply was modified 2 years, 3 months ago by Mahesh Patel.
-
This reply was modified 2 years, 3 months ago by Mahesh Patel.
-
This reply was modified 2 years, 3 months ago by Mahesh Patel.
Ah, ok.
On localhost:3000 (the React dev server) you need to mock the user. The user is only available on a real WordPress installation.
@rockiger
I didn’t understand what you say, what is real wordpress installation?
How the issue will resolve?
That means it didn’t work on local system.
Please clarify in detail.
Thanks
Mahesh
Your screenshot shows only the create-react-app dev server (localhost:3000). Not a wp installation, not local, not productive.
ReactPress simulates the theme of your wp installation for a better development experience when you use the cra dev server.