Showing posts with the label yarn-server

Rational Number or Rational Mothod in ruby or rational operation

Rational Number or Rational Mothod in ruby or Rational operation Rational Number is always comes with paired integer Number(1 ,2 ,3 .... && -1, -2, .....) x/y (where y>0). Rational (1) => (1/1) Rational (2, 5) =>(2/5) Rational(4, -8) => (-1/2) 5.to_r =>(5/1) 2/3r => (2/3) Rational into Numeric rational*numeric -> numeric (perfoms multiplecation) Rational(1, 3)  * Rational(2, 3)   => (2/9) Rational(200)   * Rational(1)      => (200/1) Rational(-5, 4) * Rational(-4, 5)  => (1/1) Rational(9, 4)  * 4                => (9/1) Rational(20, 9) * 9.8              => 21.77777777777778 rat ** numeric => numeric (Performs exponentiation) Rational(3)    ** Rational(3)    => (27/1) Rational(10)   ** -2             => (1/100) Rational(10)   ** -2.0           => 0.01 Rational(-4)   ** Rational(1,2)  => (1.2246063538223773e-16+2.0i) Rational(1, 2) ** 0              => (1/1) Rational(2,

Export Import component in react

 Export Import component in react See installation and configuration in my other blog Now Create a file into a public folder or anywhere into Root directory inside your project folder Create to directory into root directory         mkdir public           mkdir src Create two new into public folder index.html index.js Create two new file into src folder main.js  item.js Copy and paste code into index.html <!DOCTYPE html> <html> <head> <title>React - demo</title> </head> <body> <div id="root"></div> <script src="index.js"></script> </body> </html> Now into item.js import React from 'react'; class Item extends React.Component{ render(){ return( <div> Hello Item </div> ); } } export default Item; // you must have to make component exportable Now into main.js import React from 'react&#

you should install 'babel-loader@7'. || babel version

If you are Getting any error in compiling main.js or app.js or in Entry file of React App You have to Update Babel versions and dependency npm install -D babel-loader @babel/core @babel/preset-env webpack And change config file options: {           presets: ['@babel/preset-env']         }

Create react app by yarn-server || yarn Server || React App

first of all install Yarn from here click on get started and install yarn server Create a directory mkdir <your_directory_name> Run command yarn init (press enter and use all defaults) by this command package.json file will be created in root directory for creating Dependency we run this command yarn add babel-cli babel-preset-react --dev yarn add babel-cli babel-preset-env --dev yarn global add babel-cli babel-preset-env babel-preset-react ( Installed "babel-cli@6.26.0" with binaries:  - babel-doctor  - babel  - babel-node  - babel-external-helpers ) Now again make a directory inside root directory mkdir public (you can take name as you want) mkdir src (you can take name what ever you want you want) inside public folder create two new file index.html index.js inside src folder create one new file  main.js ( this is file where react app execution is start. you can take name what ever you want). Add this code into your i