Posts

Showing posts with the label React Component

Generate Controller, views into specific folder

Generate Controller, views into specific folder rails generate scaffold_controller api/v1/users

Make admin panel with Active admin rails || active_admin rails

Image
Make admin panel with Active admin rails || active_admin rails  Open Terminal and copy and paste this Command rails new admin_example // creating new rails application go inside the project cd admin_example run bundle install bundle install open your gem file and add this new gem's gem 'activeadmin' / / for active admin panel gem 'inherited_resources' //  making your controllers inherit all restful actions gem 'devise' // for user authentication  run bundle install again bundle install install active admin rails g active_admin:install / /install active admin to your project migrate database rake db:migrate check your seed file and run rake db:seed create user file and model rails g User name email  create post file and model rails g Post title body:text published_at:datetime user:references Now Migrate DataBase rake db:migrate start rails server rails s Hit url localhost:3000/admin/login Enter login details you can find login

Naming convention in SQL Sql Tutorial -4

Image
Naming Convention in SQL Rules to follow before specifying names(Object names, Column Names and Variable Names). Each name should begins alphabet Valid character set is a-z,A-Z,0-9,@,$,# and _ (underscore) Ex:  Emp123   Emp_o11 Names are not case sensitive Already existed names are not allowed Pre defined keywords (ReservedWords) are not allowed as names. Blankspace within a name is not allowed Max length of any name is 32 chars

SQL COMMANDS || Oracle SQL COMMANDS Sql Tutorial -3

Types of SQL commands 1) DDL(data definition language) commands:       Used to create or change or delete any data base objects CREATE ALTER DROP TRUNCATE RENAME 2) DML(data manipulation language) COMMANDS       Used to fetch data / enter new data/ changing existed data / deleting the data from table. INSERT  UPDATE  DELETE  TRUNCATE 3) DRL(dataretrieval language) Command     SELECT (logicalcommand) 4) DCL(DATA CONTROL LANGUAGE) COMMANDS     Used to control the access of data base objects. These commands are used by DBA (databaseadministrator) GRANT  REVOKE 5) TCL(TRANSACTION CONTROL LANGUAGE) COMMANDS      Used to save or cancel the actions/transactions made on table data. COMMIT  ROLLBACK  SAVEPOINT

Export Import component in react

Image
 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&#

Print static text in React by webpack using Function component

Image
Install Webpack and configure it first 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 a new file into src folder main.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 main.js import React from 'react'; import ReactDOM from 'react-dom'; function Welcome() { return (<div> Hello </div>) } const root = document.getElementById('root');  ReactDOM.render(<Welcome />, root); Project Structure will be like this

Print static text in React by webpack using class component

Image
Install Webpack and configure it first 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 a new file into src folder main.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 main.js import React from 'react'; import ReactDOM from 'react-dom'; class Welcome extends React.Component{ render(){ return( <div> Hello  </div> ); } } const root = document.getElementById('root');  ReactDOM.render(<Welcome />, root);

set mode on webpack.config.js || webpack file configuration

Give mode in webpack.config.js            mode: "development || production"  //whatever you want to give Use it before Entry module.exports = {   mode: "development",    entry: './src/main.js', // Bundle all assets from this location together    output: {        filename: 'index.js', // Output to this file        path: path.resolve( __dirname, 'public' ), // In this location    }, 

React Application by Webapck || webpack install

Image
Create a directory into your local         for windows            mkdir react-demo         for linux                       mkdir react-demo Go to directory             cd react-demo Type npm init            for installing node and creating package.json file npm i webpack --save-dev           create dependency by webpack npm i webpack-cli --save-dev           This cmd is used to create dependency for webpack-cli in package.json file.           Like -             "devDependencies": {            "webpack": "^4.16.2",            "webpack-cli": "^3.1.0"             } npm install -D babel-loader @babel/core @babel/preset-env webpack "devDependencies": {    "babel-core": "^6.26.3",    "babel-loader": "^7.1.5",    "babel-preset-env": "^1.7.0",    "webpack": "^4.16.2",    "webpack-cli":

What is WebPack || WebPack React app by webpack || babel loader || babel core || babel

Image
Webpack is a tool that puts all your assets including images,javascript ,fonts and css in a dependency graph entry point: is the file webpack looks for to start building your Javascript bundle webpack’s main strength is code splitting. It introduce a production mode and development mode. As ,, Syntax of  ReactJS is based on ES6. old browsers doesn’t understand ES6. So , to run JS we need something which transform our ES6 code to browser understand language , the same thing is done by babel-loader. Babel-loader is a webpack loader for transpiling ES6 and above , down to ES5. For this, you need three things - babel-core, babel-loader, babel-preset-env   Commands- 1. npm init: This cmd create a package.json file . 2.npm i webpack --save-dev: This cmd generate dependencies for webpack in package.json file. Like "devDependencies": {    "webpack": "^4.16.2"  } 3. npm i webpack-cli --save-dev : This cmd is

React Component || Functional Component || Class Component || composing function component

What is Component? React Components that render html elements and tags Types of Component Functional Component Class Component Functional Component Render html element through function Class Component Render html element through class Composing function component Means call a function component into another function component Functional Component Example 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). app.js or main.js function Item(){ return(<h1>Hello from Item</h1>) } function Welcome(){ return(<div> <h1>Hello React</h1> <Item />  </div>); } const element = <Welcome /> ReactDOM.render(e

React Component || Functional Component || Class Component

What is Component? React Components that render html elements and tags Types of Component Functional Component Class Component Functional Component Render html element through function Class Component Render html element through class Functional Component Example 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). app.js or main.js function Welcome(){ return(<h1>Hello React</h1>); } const element = <Welcome /> ReactDOM.render(element, document.getElementById('root')); in index.html <!DOCTYPE html> <html> <head> <title></title> <script crossorigin src="https://unpkg.com/