Render custom components without node installation

html react js 6 years, 6 months ago
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.2/browser.min.js"> </script> <title></title> </head> <body> <div class="" id="app"> <script type="text/babel"> //Creating custom components var FirstComp = React.createClass({ propTypes: { name: React.PropTypes.string, location: React.PropTypes.string.isRequired }, getDefaultProps: function(){ return { name: 'koderplace', location: 'web' } }, render: function(){ let name = this.props.name; return ( <div> <h1 style={{color:'red'}}>hello, {name}</h1> <h1>location, {this.props.location}</h1> </div> ) } }); //End of renderer ReactDOM.render(<FirstComp name='harika' />, document.getElementById('app')); </script> </div> </body> </html>
2171
Instructions

Copy this code into your test html and then run it. If u have worked with normal html , this also works in the same way..Nothing new. It is just that we render the div with react code. Happy Coding

//Just a hint
There are 5 life cycle methods . According to the need add that as a function inside custom component creation and proceed to see the awesome results.
https://hackernoon.com/reactjs-component-lifecycle-methods-a-deep-dive-38275d9d13c0

Posted By
Work with inline styles in React js
//plugin to any test js file and proceed
//This is the best standard to work with
const style = {background:'cyan', color:
javascript react js css
harika
Work with 3rd party css libraries in react fr
import React from 'react'
//No need to give the complete path, rea
//If not exists searches globally
javascript react js
harika
work with react without node installation in
//Basic way
<!DOCTYPE html>
<html>
javascript react js html
harika
Difference between state and stateless compon
//State Component
<!DOCTYPE html>
<html>
javascript react js
harika
Create a React app without webpack and Create
//Basic way
<!DOCTYPE html>
<html>
javascript react js webpack
harika
JQuery toggle functionality in react
import React from 'react'
export default class ToggleComponent ext
  constructor(props){
javascript react js
harika
display state inside any html tag
import React from 'react'
export default class StateProps extends 

javascript react js
harika
Import any class irrespective of default expo
import React, { Component } from 'react'
javascript react js
harika
Pass Data/Properties from child to parent in
//Parent.js
import React from "react";
import Child from './Child'
javascript react js
harika
Set Component state from other component / ou
/*App.js*/
import React, { Component } from 'react'

javascript react js
harika
Compress files synchronously in javascript
const tar = require('tar');
  tar.c(
    {
node js javascript react js
harika
Extract files synchronously in javascript
const tar = require('tar');
  tar.x(
    {
node js javascript react js
harika
How to get first element of the list in Djang
<h3> Print all elements</h3>
<div>
    {% for item in my_list %}
html python django
kishore_kumar
Search options in bootstrap select , search s
<script src="https://ajax.googleapis.com
<script src="https://maxcdn.bootstrapcdn
<link href="https://maxcdn.bootstrapcdn.
html bootstrap
kishore_kumar
How to iterate json object in angular js
<html>
    <body>
        <table data-ng-repeat="(key, val
html json angular js
harika
How to get key value pairs of json object in
<html>
    <body>
        <table data-ng-repeat="(key, val
html json angular js
harika
template filters for slice string and print n
<!-- will give first 100 characters from
{{ my_string | slice:"100 "}}

html python django
kishore_kumar
for loop counter in python Django template
{% for my_object in my_object_list %}
    {{ forloop.counter }} {# starting in
    {{ forloop.counter0 }} {# starting i
python django html
kishore_kumar
Load html inside webview using react native
// html.js
module.exports = function() { return `
<html>
html react-native webview javascript js
harika
Load native javascript inside webview in reac
import React, { Component } from 'react'
import {View,  WebView} from 'react-nati

html react-native webview javascript js
harika