Ink: Question: Reusing React?

Created on 22 May 2018  路  10Comments  路  Source: vadimdemedes/ink

Forgive me if this discussion has happened elsewhere already, or if this is not even possible... but I'm curious if its been discussed to make ink basically analogous to ReactDOM, but for interacting with the cli, while being able to reuse React itself for all of the component-based logic?

Curious to hear your thoughts!

_p.s. this library is awesome, thank you for your contributions!_

Most helpful comment

I have a small POC working for this just to prove out feasibility - @vadimdemedes let me know if you think this is a direction that would make sense for this project, otherwise I can spin it off into a different one.

All 10 comments

also if this seems remotely plausible, would you be open to a pull request POC'ing this?

@mgrip
I had thought the same. Theoretically, ink should not mimic React, only should it conform to React's API. I checked MobX (a library that uses React's API) does not get along with ink.
If ink was created based on React and implemented like ReactDOM, it should work with MobX.

But I also think it's really tough to understand React API and how it should be implemented compatible with React (like ReactDOM).
In addition, I guess lifecycles and refresh schemes of browser's DOM and CLI's components are different, so maybe we have to imitate the React's logic.

Any idea?

To author, maintainers

I love this project. Thank you for your contributions!

MobX

https://github.com/mobxjs/mobx

Ya it would definitely be difficult, but I don鈥檛 think impossible. I鈥檓 happy to start working on a POC, but I would want to make sure that aligns with the intent of this project - which I think would be a question for @vadimdemedes

I was thinking about this as well over the weekend. I ran into an issue with getChildContext behaving differently than React. ink could skip the cost of seeking/maintaining parity with React internals by instead being a render path like ReactDOM.

What are the downsides to using React itself?

I have a small POC working for this just to prove out feasibility - @vadimdemedes let me know if you think this is a direction that would make sense for this project, otherwise I can spin it off into a different one.

Hey @mgrip, sorry for late reply, but yes, I would definitely be interested in reusing React! If you could send the link to a repo with a POC, it would be awesome!

No worries! Sorry I wanted to use this as a dependency for a different project I was working on, so I built it already as a new project 馃槙 https://github.com/mgrip/react-cli

@mgrip That's great! Thank you for sharing, I will start experimenting with your reconciler and see what happens :)

Feels good to close this issue :) Ink 2 uses React!

Looks awesome, thanks @vadimdemedes!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zkat picture zkat  路  7Comments

zkat picture zkat  路  7Comments

treshugart picture treshugart  路  4Comments

maticzav picture maticzav  路  6Comments

danikaze picture danikaze  路  5Comments