Skip to content

Is there a way to use React components natively in mint? #350

Answered by gdotdesign
mrjones2014 asked this question in Q&A
Discussion options

You must be logged in to vote

It's not trivial but it can be done, you will need to have a custom build for it:

  1. You need to change the runtime to include your component under the Mint global object (https://github.com/mint-lang/mint-runtime/blob/master/source/Main.js#L46 MyComponent: MyComponent)
  2. Build the runtime.js file and copy it into the code of the compiler https://github.com/mint-lang/mint/blob/master/src/assets/runtime.js
  3. Expose a reference to the component in the wrap_runtime method (const MyComponent = mint.MyComponent)
  4. Build the mint binary
  5. You can use your component using the reference and inline JavaScript _h(MyComponent, props, children)

A way to interoperate with NPM will be possible before 1.0.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Sija
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #350 on December 26, 2020 20:38.