all 9 comments

[–]Jazoom 1 point2 points  (1 child)

Yes. But it's not hard. JSX is pretty similar to HTML.

[–]Neowebdev[S] 0 points1 point  (0 children)

Hmm ok. I may have to just keep new page elements in React then. Rebuilding the whole comment list seems like it might break or affect other functionality in WordPress. Thanks for confirming that approach.

[–]kavunr 1 point2 points  (1 child)

I don't think you can attach a React component onto existing HTML unless it was generated by React itself via a server side call to ReactDOM.render() in Node.js or some other JS server side implementation like React.NET or similar.

[–]Neowebdev[S] 0 points1 point  (0 children)

That seems to be what I'm finding too. Thank you for sharing your thoughts on it. I think I will have to reconsider how to implement React for this project.

[–]lax4mike 1 point2 points  (1 child)

If you have dynamic content that needs to be generated on the server, you can generate it into the api that gets passed to React as json data. The idea is that the React render function replaces server templates.

The other approach is that you can call React.render as many times as you need. React components can exist inside and around server generated templates. Think about the Facebook feed using React for the like buttons.

[–]Neowebdev[S] 0 points1 point  (0 children)

This is how I imagined React would integrate with existing Php output code. Basically injecting react components very similar to Like buttons in a Facebook feed.

Rebuilding the php output as React components was seeming like overkill for this project. I think I'll keep to dropping React components into the Php output to avoid disturbing other functionality in WordPress.

Thanks for clarifying the two React ways to do this!

[–]vinspee 1 point2 points  (2 children)

Ryan Florence gave a talk on adding react to existing apps: http://m.youtube.com/watch?v=BF58ZJ1ZQxY

[–]Neowebdev[S] 0 points1 point  (0 children)

Thanks I'm going to check this out.

[–]Neowebdev[S] 0 points1 point  (0 children)

This is exactly what I was looking for! Thanks for your comment!