ReactJS, JSX and <script> - reactjs

I'm new to ReactJS and have been trying to figure out the best approach to setting up the front end. I am trying to use a bootstrap template (https://colorlib.com/polygon/gentelella/index.html). I know JSX and HTML are different but are also very similar. When I try and use a snippet of HTML from the bootstrap template as JSX, the styling will appear correctly in the browser, but none of the buttons or graphs work. I imagine this happens because JSX is different from HTML and the rendered version in the browser does not respond to the browser JS. Is there any way around this? Do I have to rebuild all the functionality that comes with the template in a component?

Related

Looking to integrate free templates from 'https://startbootstrap.com/' into my react app

I want to download one of the free bootstrap templates and add said template to my react app. I tried reading some of the documents but I can't find any documentation on integrating these free templates with react.
I did an npm install for the template I liked but I'm not sure what to do next. I just have the template in my node_modules directory.
I took what was in the body of the html file in the template and threw it in the return for my app.js. Added the css and vendor folder. Then I tried to import the templates css file to my app.js as well as change what was needed in my index.html file. Some of it worked. Other parts didn't.
Just looking to properly integrate these nice looking templates into my react projects.
Any help would be greatly appreciated!
The issue is these templates are built with Bootstrap in mind not React. These templates were created using regular HTML, CSS, JS, jQuery, etc.. and won't work out of the box for a React application. So in order to get one of these templates to work, within the context of React, one will have make manual changes to numerous parts of said template.
For example, in addition to grabbing the pieces of the template desired for your React application one will have to change numerous attributes listed within the HTML pages provided by the template. This is because in React you can't use keywords reserved for JavaScript in JSX.
So what does this mean?
You'll have to change the class attributes in the HTML to className for your CSS style rules to take effect from the template. onchange becomes onChange, onsubmit becomes onSubmit, etc...
The standard is to camelCase reserved JavaScript keywords in JSX.
You can definitely get this template to work in React it will just involve some manual tweaking on your end. However, if you want a template to work out of the box for React I would look into a free template built with React in mind.
Hopefully that helps!

css not working in child theme when using ng-include

I'm using AdminLTE template to create a simple web app. I'm traing to use AngularJS for my front end. I want to split my theme in some child themes because it's easier to mantein. To do this, i use "ng-include" directive, but the html in the child view isn't beeing display correctly:
in the past when I was using php with i don't have the same problem. WHat can I do?
Solution. I was using:
when using tag "ng-Include" the css don't work. So i include the first line of profile.html and i add the ng-Include directive:
This work fine for me!

How to run a validation check with Ionic

I have written an ionic application and would like to know how(if) i can validate the ionic app. Much like validating HTML with W3C.
Is there any way possible to run a validation check on the app.
I have tried to run the application in the browser and run a google chrome local html validation, however the directives are still visible and haven't been generated to html.
I don't believe there is a way to validate the Ionic HTML in the same way you validate the HTML in W3C validator.
however the directives are still visible and haven't been generated to html
Probably a bit of confusion here.
1. AngularJS directives will always be visible "as is" in the HTML code, they will not transform to anything. It's AngularJS itself to use them in its special way.
2. Ionic components are build with custom HTML tags, which means, for example will not transform to anything else. All Ionic custom tags are defined in ionic.css file.

Leaflet angular error not render properly

I am trying to implement a simple leaflet map in my angular test page. I am having the problem you see in the photo attached.
My code is the code in this example:
http://jsfiddle.net/tombatossals/4PhzC/
I have some other things in my page as for example bootstrap libraries to draw some lists and jquery lib. Also, I import ngroutes and socket components . And I am painting the map webpage inside this directive:
<div ng-view></div>
I don't know why inthe example it works and in mine, it doesn't render fine.

Changing pages in AngularJS (under requireJS)

I'm a beginner in AngularJs and I have a simple question: How do I change pages in AngularJS?
Not using router (ng-view) in AngularJS since I need a new html page where there's no common templates. I tried to use "ng-href" but it doesn't work well, since the system works under requireJS and the new html doesnt contain any js or css that I need. (except I force to add them..)
Does anyone has got some idea?
you can achieve with some template engine like "Swig" http://paularmstrong.github.io/swig/ with has a layout template were you base js and css and you can extend it.

Resources