Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

javascript - 在ReactJS APP中导出javascript方法以从外部非React APP调用(Export a javascript method in a ReactJS APP to call from a outside non React APP)

I need to export/publish a javascript funtion as a entry point in my ReactAPP, so a external non React App, can call that javascript method to render I have my React APP in a package js file, not the components files separated.

(我需要导出/发布javascript函数作为我的ReactAPP中的入口点,因此外部非React App可以调用该javascript方法来呈现我的React APP在js包中,而不是将组件文件分开。)

The javascript method i want to do is like show(ComponentName,divID) where componentName is the name of the component to show and the divID is the location, inside the show file i going to do a ReactDOM.render..... The idea is the external Aplicacion import the JS file of the entire React APP.

(我想做的javascript方法就像show(ComponentName,divID),其中componentName是要显示的组件的名称,而divID是位置,在显示文件中我要执行ReactDOM.render .....想法是外部Aplicacion导入整个React APP的JS文件。)

and call the show method by window.show...

(然后通过window.show ...调用show方法。)

Any ideas?

(有任何想法吗?)

Thanks!!!

(谢谢!!!)

  ask by Rulo Rangugni translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...