I am new to react and i'd like to know how to generate few dynamic widgets which I could embed onto different page of one App, as getting started react tutorial tells:
You can then either gradually expand its presence, or keep it
contained to a few dynamic widgets
I haven't found any instructions on how to achieve that though.
I've integrated a single component into my app using ReactDOM but what I don't understand is how can I build and output multiple bundles?
So what I want to achieve is:
build a Widget Components and output it as a file per widget: Example1.js, Example2.js, ...
using div container and script tag embed a widget into existing App
Related
I asked a similar request in the Git Repo as well here, https://github.com/vasturiano/react-globe.gl.
I have an app that uses the react component exported by this project. It depends on three.js and WebGL to work. It is an extension of this repo by the same author, https://github.com/vasturiano/globe.gl.
I made a beautiful web app with these libraries and all works as expected, on the web, but I want to extend this to a mobile app built on react native as well.
I have tried a simple port but get an error from the CSS2DRenderer trying to access the document object which clearly doesn't exist on a mobile app.
I tried using expo GLView here, but could not for the life me figure out where to start on the context creation function to be able to port the three globe to it.
My question is, based on the Repo's I have shared above, what is the best approach to implementing the Globe in React Native?
I would also take any alternatives that I could do drag/zoom Globe with dynamic plot points and interactive functions (click basically).
For a quick setup to recreate the project, I am working an out of the box react native application setup
npm i react-globe.gl
Pop below component inside of a View in the app.js and import the Globe from above library. Provide an empty array for hexBinPointsData
<Globe
globeImageUrl="//unpkg.com/three-globe/example/img/earth-night.jpg"
bumpImageUrl="//unpkg.com/three-globe/example/img/earth-topology.png"
backgroundImageUrl="//unpkg.com/three-globe/example/img/night-sky.png"
hexBinPointsData={plotData}
hexAltitude={0.1}
hexBinResolution={4}
hexBinMerge={false}
/>
Expected error: Document variable cannot be found. In the CSS2DRenderer.js file.
Any help would be appreciated!
I have a small demo application built with React that I would like to embed within another React app that contains a section for multiple demos. What is the best way to go about this without simply rebuilding the small app in the larger app?
Ideally, I would like to have the demo built as a component within a single js file that I could import into the larger app.
I am currently storing an object containing many React components and would like to display them all in some sort of gallery format.
I tried rendering the component directly in the gallery itself, but it was too slow and caused too many DOM issues.
Similar to how Google Drive displays a preview of each doc, what is the best and fastest way to generate a visual snapshot of each component in React?
You can check Storybook, it's an open-source tool for developing UI components in isolation for React and other libraries and there is a lot of useful add ons which will help you during work process.
I have tried this for myself you can check it here react-ui
If you want to have some page with a list of all components, you can create one story where you can show a list of all stories which you have in your project.
How can we use share components between react-native and react web projects. I have read react native can be derived from react. How is it possible to use same js code between two projects (fully or partially) ?
Take a look at the react-native-web library. It's pretty good:
https://github.com/necolas/react-native-web
As long as you only use react native components, e.g. View instead of div, and Text instead of p etc, you'll be able to share view components between your app and website. Then you can pass down all the data from API calls etc as props from within the individual mobile app/website code.
In my projects I have a common folder that contains all these shared view components, and only put the platform specific code inside mobile or web-app. It works pretty well that way.
We are currently moving an application from asp.Net to React/Redux and .Net core. The application is really complex so we are trying to make so that each page its is own module. But there certain components (Modals, PDF viewers, and other specialized viewers) we need to access throughout the application. Is there a way to add these components from other React projects in a specific application without having to load the entire application. Or maybe create a core React/Redux library that goes in the entire application?
Thanks
Note: we are currently using Webpack, ES6, React and Redux
As a sibling to your modules directory, you may have a shared directory. Inside here, usually, you'll have directories like styles/, fonts/, images/, and ... components/. The components here may be thought of as the atomic structures that create your "molecular" modules. For example, any custom UI components (e.g., buttons, dropdowns, tooltips) go here--assuming you're opting out of MaterialUI.
Then from within your larger "feature" components, you import these components and use them.
As a further step, you can build all your shared components as a private npm module and bring it in that way.
Since Redux is in the discussion, aim to make your routed components be container components. In other words, in <Route path='/something' component={ThisComponent} />, ThisComponent ought to be a generated container component, via the connect()() method.
I would advise against using a Router as your application could easily break should the .net application change urls.
Another option would be to use something like React Habitat