rockiger
Forum Replies Created
-
Strange, you shouldn’t been allowed to activate the plugin as PHP 7.4+ is required.
Unfortunately, I can’t help with the update of your PHP version. I recommend using Local as a dev environment for WordPress.
PS: If you like the support or the plugin, consider leaving a review.
Hey @lyle,
it seems that your php installation doesn’t allow arrow functions. Do you have php 7.4 or older or deactivated arrow functions?
Please stick to the documentation:
- Install ReactPress on your local WordPress installation.
-
In your command line use npx create-react-app [your-app-name] in the apps directory of ReactPress, e.g.
[path-to-WordPress]/wp-content/reactpress/apps/my-app
- Reload the ReactPress admin page and add a URL Slug for your app.
-
In the command line start the React app with
npm start
oryarn start
. - Develop your app, changes will automatically hot reloaded.
- When you are finished, build the app from the command line. You can now see your app embedded in your WordPress instance. Open it at [your-domain]/[your-slug].
- To deploy, Install ReactPress on live WordPress site.
-
Upload the build folder from your dev system under
.../wp-content/reactpress/apps/[your-app-name]
to the same directory onto your live server. No need for create-react-app. - Reload the ReactPress admin page and add a URL Slug for your app.
- Open the React app under [your-domain]/[your-slug].
All steps are mandatory and there shouldn’t be any deploy button.
BTW, the newest version of ReactPress provides custom routing. See the FAQ.
Forum: Plugins
In reply to: [ReactPress - Create React App for Wordpress] Identify current userThere is one global js variable ‘reactPress’. It has two properties
user
andusermeta
.If the user is logged in, the holds the user data, otherwise, they are empty.
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
.Forum: Plugins
In reply to: [ReactPress - Create React App for Wordpress] react app as block in a pageUsing one app in more than one is not possible at the moment, sorry. You have to copy the build folder of the app for every place you want to use it.
I have that on the feature list right now, but I don’t know when I will start with that feature. But I am happy to accept pull requests: https://github.com/rockiger/reactpress/issues/12
Forum: Plugins
In reply to: [ReactPress - Create React App for Wordpress] react app as block in a pageI am not 100% sure, what you want to do. The page where the react-app is shown must be the page with the slug defined in the ReactPress settings.
After this page is created. You can change this page however you want, as long as the code snippet above is present.
Hope this helps.
Forum: Plugins
In reply to: [ReactPress - Create React App for Wordpress] Multipage React App Not WorkingI released a new version, that will allow the use of react-router. For it to work with in existing app, you will need to change the slug or delete the app and reinstall the app.
After you did that you will need to go to your permalink settings in workspace and hit the save button.
Hope this helps.
You don’t use it to build a theme. The whole point of ReactPress is to use inside a WordPress site with a normal WP-theme.
If you want to create WP themes with React you need to use frameworks like Frontity or Next.js.
Hi @ryan1775clark, the latest react version I use is 17.0.2.
When you say it works for our team members, do you mean it’s running on localhost with
yarn start
?If your app doesn’t work inside WordPress, could you test the build with another static server like serve?
Did you replace [appname] with the name of your app?
Both issues you describe doesn’t seem to have something to do with ReactPress. I am sorry I can’t help you.
Did you replace [appname] with the name of your app?
When I look at the link. I don’t see any React app there. Only a
<div id="root"></div>
.Maybe something went wrong during deployment. Please double check that you followed these steps:
- Install ReactPress on your local WordPress installation
- Use create-react-app from the command line in the apps folder shown in ReactPress
- Reload ReactPress page and give the app a slug
- Develop your React app
- Build the app
- Install ReactPress on live WordPress site
- Create the same folder there (no need for create-react-app) there
- Upload the build folder of your React app into the created folder.
- Reload ReactPress page and give the app the SAME slug.