React Js Code Samples



Filters


Pass Data/Properties from child to parent in react js
harika | 5 years, 9 months
//Parent.js
import React from "react";
import Child from './Child'
Check by Parent.js,Place both in the same location and test. Happy Coding :-)
javascript react js
Create a React app without webpack and Create-react-app
harika | 5 years, 10 months
//Basic way
<!DOCTYPE html>
<html>
javascript react js webpack
Import any class irrespective of default exports
harika | 5 years, 10 months
import React, { Component } from 'react'
Small explanation to understand correctly In the external js file React has been tagged with expor
javascript react js
Difference between state and stateless components in react js
harika | 5 years, 10 months
//State Component
<!DOCTYPE html>
<html>
Stateless Component : A pure dumb component just process the request on the set of properties and re
javascript react js
Work with 3rd party css libraries in react framework
harika | 5 years, 10 months
import React from 'react'
//No need to give the complete path, react framework internally searches 
javascript react js
work with react without node installation in html
harika | 5 years, 10 months
//Basic way
<!DOCTYPE html>
<html>
javascript react js html
Render custom components without node installation
harika | 5 years, 10 months
<!DOCTYPE html>
<html>
  <head>
Copy this code into your test html and then run it. If u have worked with normal html , this also wo
react js html
Set Component state from other component / outside function
harika | 5 years, 5 months
/*App.js*/
import React, { Component } from 'react';

To check the changes try to create a react app using create-react-app demoapp and replace the code i
javascript react js
Compress files synchronously in javascript
harika | 5 years, 5 months
const tar = require('tar');
  tar.c(
    {
try to install 'tar' using npm and then try. Happy Coding :-)
node js javascript react js
display state inside any html tag
harika | 5 years, 10 months
import React from 'react'
export default class StateProps extends React.Component {

Whatever html tag it is just wrap it inside curly braces ({}) as a value.
javascript react js
Next