• Resolved afshinmoshrefi

    (@afshinmoshrefi)


    I need to pass wp_userid and a token from wordpress to react.
    currenlty I’ve implemented it with a javascript cookie which works.
    the issue is that the data is exposed in the client source.

    Is there a better way I can pass data from wordpress to react that would be more secure and less obvious?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author rockiger

    (@rockiger)

    There is one global js variable ‘rp-react-app-asset-0’. It has two properties user and usermeta.

    If the user is logged in, the holds the user data, otherwise, they are empty.

    candidek

    (@candidek)

    Hi – can you please clarify where this global js variable is? Can you query this from the React app? I’m assessing whether we can build a React app combined with a WordPress membership site but would need to pass information from one to the other…

    Thanks!

    Plugin Author rockiger

    (@rockiger)

    Have a look into the source of the generated page. The var is called reactPress.

    You should be able to access it directly or with window.reactPress.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘pass data from wordpress to react app’ is closed to new replies.