Sunday, October 16, 2022
HomeWordPress DevelopmentReact, the Humble - Write as soon as, render in Internet and...

React, the Humble – Write as soon as, render in Internet and Native


Utilizing the Humble Object sample to render React in each net and native environments.



What’s the Humble Object?

Normally used for testing, you cut up the logic from the GUI and make the GUI humble.

This separation makes it simpler to check the logic because you needn’t fear in regards to the GUI and the right way to name the capabilities by it.

This additionally makes it simpler to render the identical logic in several parts, even when completely different engines will render these parts.



POC

I made this as a proof of idea, may I write a customized hook and use that very same hook in each net and native?

YES!

Being a POC I did not actually care about issues like linting, testing, and even how it could scale from there.

Whereas I personally assume it could be higher to have all parts subsequent to one another, it could undoubtedly make the work more durable in the long term.

Right here’s the hyperlink: https://github.com/Noriller/react-reusability-poc

(The how-to check it your self is within the README)



Making it higher

Every meta-framework (assume expo for cell, and any of cra, vite, subsequent, remix, redwood… for net) has its personal dependencies, configuration, and no matter else it wants.

To account for that and nonetheless be capable to do issues, I consider a monorepo is the way in which to go. Every of the logic, net, and cell would go to its personal folder and have no matter it wants there.

And even in several folders, the essential of getting the logic agnostic of the render would nonetheless be there and make it attainable to reutilize code, multiplying the time of the builders.



Write as soon as, render anyplace

Internet, Native, VR, TV… whereas this POC solely covers Internet and Native, contemplating all that adjustments is simply the renderer, then you possibly can have a monorepo protecting all that.

For good or evil, this additionally means you possibly can have somebody engaged on the logic, one other on the internet, and a 3rd on the cell.


Cowl Picture by Ivan Diaz on Unsplash

buy me a coffee

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments