By the way, all of these CodePens are based on the first CodePen in the React documentation. The React documentation is VERY good and full of CodePens you can play with. Strongly recommended. My goal is to apply this to WordPress concepts as quickly as possible, but I’m showing similar concepts, I recommend you read both my posts and walk through the React interactive, introduction to React tutorial on the React site. … [Read more...] about React Basics For WordPress Developers
Role attribute react
I also changed the save callback so it returns null. Because I did that, Gutenberg will save the attribute values as an HTML comment in post content. That comment will be stripped out at render-time. You can use a PHP render callback, like a shortcode callback or you can save the attributes in HTML markup, or you can save them in post meta. There are a lot of options documented here. … [Read more...] about Using React For WordPress Gutenberg Development
Yes, If… If you need to make just simple blocks, maybe with one or two controls, then you do not need to know React more than those two concepts I mentioned before. But, if you want to create a more complex block, share components between Gutenberg and other React apps, for example, a wp-admin settings screen or mobile app for your plugin. … [Read more...] about Do You Need to Know React as a WordPress Developer?
I should mention that the new React context API is an alternative approach to this problem. Context API is powerful, but I’d learn this way first, then watch Wes Bos’ video on the context API and think about which problems you have may be better solved with context API then “props drilling.” But for a few layers, this strategy is simple and prop-types and Jest can catch the problems it introduces. … [Read more...] about Testing Nested Components In A React App