I'd like to use one React Native Component (https://www.npmjs.com/package/react-native-gifted-chat) inside my vanilla javascript project.
Is it possible to render React Native component inside vanilla javascript project? If so, then how?
Are you creating an iOS or Android app? I assume not because you are doing vanilla JS which can't be used alone for an app. In that case you can't use a React Native package. It is meant for iOS and Android, not HTML. Try looking for React packages.
Related
First, sorry for my bad english.
Well...
I'm working on a UI Lib using stencilJs and in another project I'm using react-native-web to make easier my web and mobile dev... But my custom component that I've created in stencilJS project only works on web, in mobile version shows this error:
Invariant Violation: View config not found for name My-rating.
And my question is... Theres a way that I can use my StencilJS components in React Native?
Thx.
I have a design of the website which contains javascript without any framework. Now I'm in the development process and I need to use javascript framework like react for a specific process. so, will it work or I need to transform everything into a framework? I'm working with Laravel and how can I make multiple react app for a single website inside Laravel framework?
Yes. This is exactly the problem that Facebook aimed to solve by creating React. They initially only used React for parts of the comment system and their chat.
You can create a React component and use it in only part of your website. You just need to provide it a place for it to mount. That is, a div where you are mounting your application.
Check the documentation for React DOM and the integration guide for more information about rendering to the DOM. The basic idea is to create your component then use the following code to render it:
ReactDOM.render(element, container[, callback])
From the React docs:
React can be used in any web application. It can be embedded in other applications and, with a little care, other applications can be embedded in React.
To integrate React with other libraries or frameworks, check out the React integration guide: https://reactjs.org/docs/integrating-with-other-libraries.html
Yes you can create global window renderer functions from react library and call it from vanilla js or some other third party library like jquery .You just need to include the minified js to call that function.
Some thing like below on react
const app = (parameter1,parameter2) => (
<YourComponent parameter1={parameter1} parameter2={parameter2}/>
);
window.renderYourComponent = function (p1, p2) {
render(app(p1,p2), document.getElementById('your_div'));
}
On your vanilla js
<script type="text/javascript" src="your_minified_react.js"></script>
<div id='your_div'></div>
window.renderYourComponent("p1","p2");
Everything will be rendered inside 'your_div' and you can work separately on react
Yes, You can make multiple React apps for a single website inside the Laravel framework.
The Laravel often uses a blade template for frontend UI.
What you need to do is build the React app and integrate the built React app with the Laravel blade.
You can copy the whole built contents of the React app into the Laravel home blade, for example.
In addition, inside React to import custom Javascript files, you can use several ways like script tags and also webpack copy module.
I couldn't find an answer to this... so, when I open a new project in WebStorm I have the 4 options (and many more) mentioned above - AngularJS, Angular CLI, React Native & React App. I have found out that Angular CLI is corresponding to Angular 2.
My question is: which of the 4 or maybe another option I did not mention here is corresponding to Angular 4 which is the newer version of Angular 2 as I understand it.
Also, if someone can please help me understand better the difference between the 4 options I have mentioned: which should I use and for what purpose? For example if I want to build a minesweeper game, which of the three would you choose?
Also, in my search I've found that React Native is for mobile use (apps) so what is the difference between that and React App? And is any of these are suitable for creating a game in PC browser (and not on mobile)?
1.'Angular CLI' option allows creating Angular 4 project using Angular CLI
'AngularJS' option just clones https://github.com/angular/angular-seed - a project stub for Angular 1 application
'React Native' creates a React Native project stub using react native cli
'React App' creates a React project stub with create-react-app
React itself is a JavaScript library; React Native allows creating mobile applications using React library + native components. If you like to create a web game to be run in browser, you don't need react Native. You can use React, or Angular.x, or any other JavaScript framework that supports creating custom UI components
I am new to React Native, and I understand React Native injects JS to a JavaScriptCore. By looking at the examples or new react app, I can see the JavaScript is hosted in localhost:8081. In release/prod version, JavaScript files shipped within the app.
Can React Native use some JavaScript(React JS) from server in production? (like WebView which can load any html locally and remotely)
It would be great if we can deploy new UI without App release.
Thanks in advance.
Yes. Its possible to update new UI without App release in React Native.
We need to use react-native-code-push library to enable dynamic app update.
So... I just started to learn React Native to create an android app, and I am a little confused, should I only use java script for the visual part with react and the rest of the app with java ?
Or can I make the whole app with javascript and some Node modules ?
You can write everything in Javascript for Android and iOS. That's the purpose of react-native. See an Android code example here: http://code.tutsplus.com/tutorials/creating-a-dictionary-app-using-react-native-for-android--cms-24969
But you can also mix in native Android Java classes and then import then call them in your JS code. This is useful if you want to use components which are currently not yet implemented in react-native. Check out this example to read more about using native components: https://facebook.github.io/react-native/docs/native-modules-android.html