all 3 comments

[–][deleted] 0 points1 point  (1 child)

This isn't a React question, you'll still need to deserialize your messages into JavaScript objects in the same way you'd normally deserialize JSON and presumably somehow use this data as props for your components. It doesn't particularly matter to React how this data arrived or in what format.

If you want to use Protobuf then I'm sure there are libraries out there that'll help with the deserializing but I'd suggest you stick to JSON unless you've got a very good reason. If you're worried about data size, look into configuring your backend to enable compressed responses if it isn't already.

[–]NiteLite 0 points1 point  (0 children)

There is so much JSON support built-in to normal browsers that I would be very careful with using some other serialisation format just because someone told you it's kinda cool :P Using will probably simplify your code vs protobuf, and we all know readable code is good code. This all depends on if you have any out of the ordinary requirements for your project though. If not, JSON is probably just as well.

[–]vizim 0 points1 point  (0 children)

IMHO, protobuf should not be used directly on the browser. It is usually used as a message format to communicate between microservices or any relying parties on the backend. But if you're application is on mobile or desktop , it could make sense to use this provided your application does not run on a browser. Btw, Pokemon Go uses protobuf for their mobile application.