python |
Pythonタグが付けられた新着投稿 - Qiita |
HackTheBox Agile WriteUp |
https://qiita.com/Perplex/items/b5cb69ae14387d063b88
|
agile |
2023-08-06 17:55:08 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
CSVをMySQLに入れるPythonをChatGPTに書かせてみた |
https://qiita.com/Hotari/items/7b90028d9b6fa8aed8ac
|
chatgpt |
2023-08-06 17:45:46 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【Python】poetry でCPU用のtorch 環境を用意する |
https://qiita.com/XPT60/items/894841b57995bef1e81c
|
poetry |
2023-08-06 17:26:15 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
PythonとBokehを使用して画像付きの散布図を作成する |
https://qiita.com/yskn08642/items/9cb22c626ebd995fc053
|
bokeh |
2023-08-06 17:25:47 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Railsチュートリアル8章まとめ |
https://qiita.com/qiita-oy/items/9356af5bce8641457843
|
rails |
2023-08-06 17:49:11 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
[備忘録] AWS CDK プロジェクトの作成 |
https://qiita.com/m-chan/items/011a93e40f26230df135
|
awscloudformatio |
2023-08-06 17:18:32 |
golang |
Goタグが付けられた新着投稿 - Qiita |
GolangのTest入門(Step2:複数ケースのテストケース実行) |
https://qiita.com/kouji0705/items/1950f3408e5ad5d1639d
|
ageproductfuncaddabintint |
2023-08-06 17:41:25 |
golang |
Goタグが付けられた新着投稿 - Qiita |
GolangのTest入門(Step1:テストコード実装、実行) |
https://qiita.com/kouji0705/items/abe2ec6d002194f34d67
|
gomod |
2023-08-06 17:32:12 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
【便利】VSCodeでGitの差分プレビューファイルのみを全て閉じる方法 |
https://qiita.com/o-y/items/7ebc040dc74ed1a34e66
|
vscode |
2023-08-06 17:47:30 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Railsチュートリアル8章まとめ |
https://qiita.com/qiita-oy/items/9356af5bce8641457843
|
rails |
2023-08-06 17:49:11 |
海外TECH |
DEV Community |
*Beginner Friendly* Convert a existing website of HTML and CSS to ReactJS project |
https://dev.to/ankur0904/beginner-friendly-convert-a-existing-website-of-html-and-css-to-reactjs-project-3mfh
|
Beginner Friendly Convert a existing website of HTML and CSS to ReactJS project IntroductionWelcome to this blog This blog is for beginners who just started the web development journey If you don t know about or never heard about the ReactJS then you are in a great place In this blog we will convert a prewritten HTML and CSS website into ReactJS project from scratch Let s dive into the blog By the end of this blog I guarantee you will be able to create website like this with ReactJS with your own ReactJSReactJS is a very popular Javascript open source frontend library that helps us to build the User Interface and is very famous for the presence of reusable components concepts You can write your front end in Javascript I have already created a website using only HTML and CSS You can have a look at the live version of the website I will try to mention all the code and explain the code below I created a website for the Hypothetical startup in which suppose we are living on Mars and we want to import export product from Earth then this startup will take care of import and export from Mars to Earth and vice versa I took a lot of code from Bootstrap The BoilerplateThis is the boilerplate of our website which contains the required Bootstrap CDN Content Delivery Network taken from the Bootstrap Link lt doctype html gt lt html lang en gt lt head gt lt meta charset utf gt lt meta name viewport content width device width initial scale gt lt title gt Bootstrap demo lt title gt lt link href dist css bootstrap min css rel stylesheet integrity sha bw aepP YChEpVNVgiZdgIC VKNBQNGCHeKRQN PtmoHDEXuppvnDJzQIu crossorigin anonymous gt lt head gt lt body gt lt h gt Hello world lt h gt lt script src dist js bootstrap bundle min js integrity sha HwwvtgBNobZJJLYdoVXjrBZtcqVSpeBNSnCIVInixGAoxmnlMuBnhbgrkm crossorigin anonymous gt lt script gt lt body gt lt html gt We will also add external CSS link So that we will add some external CSS lt link rel stylesheet href index css gt HeaderThis is the code of header of the website which is taken from here lt div class container gt lt header class d flex flex wrap justify content center py mb border bottom gt lt a href class d flex align items center mb mb md me md auto link body emphasis text decoration none gt lt span class fs gt MarsXport lt span gt lt a gt lt ul class nav nav pills gt lt li class nav item gt lt a href class nav link active aria current page gt Home lt a gt lt li gt lt li class nav item gt lt a href class nav link gt Features lt a gt lt li gt lt li class nav item gt lt a href class nav link gt Pricing lt a gt lt li gt lt ul gt lt header gt lt div gt Hero SectionThis is code of the hero section visually striking area at the top of a web page which is taken from here lt div class container gt lt div class px py my text center gt lt svg class d block mx auto mb xmlns height fill currentColor class bi bi globe americas viewBox gt lt path d M a A ZM c A Z gt lt svg gt lt h class display fw bold text body emphasis gt MarsXport lt h gt lt div class col lg mx auto gt lt p class lead mb gt Welcome to MarsXport Your gateway to interplanetary trade We specialize in seamless import and export services between Mars and Earth bridging the gap and bringing the best of both worlds to your doorstep Explore the boundless opportunities with MarsXport and be a part of the future of interstellar commerce lt p gt lt div class d grid gap d sm flex justify content sm center gt lt button type button class btn btn primary btn lg px gap gt Import lt button gt lt button type button class btn btn outline secondary btn lg px gt Export lt button gt lt div gt lt div gt lt div gt lt div gt Features SectionThis is code of the features section which is taken from here lt div class containers gt lt div class container px py gt lt h class pb border bottom gt Unlocking the Universe lt h gt lt div class row row cols row cols md align items md center g py gt lt div class col d flex flex column align items start gap gt lt h class fw bold text body emphasis gt Experience Next Level Commerce with MarsXport lt h gt lt p class text body secondary gt Unlocking the Universe MarsXport redefines interplanetary trade offering seamless import export between Mars and Earth Our cutting edge logistics ensure swift secure and visionary transactions Explore boundless opportunities in the cosmos of commerce with us the future is now lt p gt lt a href class btn btn primary btn lg gt Contact Team lt a gt lt div gt lt div class col gt lt div class row row cols row cols sm g gt lt div class col d flex flex column gap gt lt div class feature icon small d inline flex align items center justify content center text bg primary bg gradient fs rounded gt lt svg class bi width em height em xmlns width height fill currentColor class bi bi speedometer viewBox gt lt path d M a Va VA zM a l a l a zM a ha HA zm a ha Ha zm a L a l a z gt lt path fill rule evenodd d M a c C c A zm a c C s c A z gt lt svg gt lt div gt lt h class fw semibold mb text body emphasis gt Interplanetary Trade Made Easy lt h gt lt p class text body secondary gt Seamlessly import and export products between Mars and Earth with our innovative logistics solutions lt p gt lt div gt lt div class col d flex flex column gap gt lt div class feature icon small d inline flex align items center justify content center text bg primary bg gradient fs rounded gt lt svg class bi width em height em xmlns width height fill currentColor class bi bi gear viewBox gt lt path d M a zM a z gt lt path d M c l a l c l a l c l a l c l a l c l a l c l a l c l a l c l a l zm c l a l c l a l c l a l c l a l c l a l c l A l c l A l c l a l z gt lt svg gt lt div gt lt h class fw semibold mb text body emphasis gt Futuristic Efficiency lt h gt lt p class text body secondary gt Our advanced technology ensures swift secure and reliable transactions propelling interstellar commerce to new heights lt p gt lt div gt lt div class col d flex flex column gap gt lt div class feature icon small d inline flex align items center justify content center text bg primary bg gradient fs rounded gt lt svg class bi width em height em xmlns width height fill currentColor class bi bi calendar check viewBox gt lt path d M a l a l a L l a z gt lt path d M a VhV a Vha va Ha Va hV a zM va ha VHz gt lt svg gt lt div gt lt h class fw semibold mb text body emphasis gt Endless Opportunities lt h gt lt p class text body secondary gt Discover a universe of possibilities as MarsXport opens up new markets and connects you to a galaxy of consumers lt p gt lt div gt lt div class col d flex flex column gap gt lt div class feature icon small d inline flex align items center justify content center text bg primary bg gradient fs rounded gt lt svg class bi width em height em xmlns width height fill currentColor class bi bi file earmark lock viewBox gt lt path d M vc vc h c Vc Va zM vhVa z gt lt path d M VL Ha va ha zM A hVa Ha Va hvz gt lt svg gt lt div gt lt h class fw semibold mb text body emphasis gt Pioneering the Future lt h gt lt p class text body secondary gt Join us on our journey to redefine commerce making interstellar trade an everyday reality lt p gt lt div gt lt div gt lt div gt lt div gt lt div gt lt div gt Pricing SectionThis is the code of the pricing section which is taken from here lt div class container gt lt div class row row cols row cols md mb text center gt lt div class col gt lt div class card mb rounded shadow sm gt lt div class card header py gt lt h class my fw normal gt Free lt h gt lt div gt lt div class card body gt lt h class card title pricing card title gt lt small class text body secondary fw light gt lt small gt lt h gt lt ul class list unstyled mt mb gt lt li gt Only for new users lt li gt lt li gt Weight under kg lt li gt lt li gt Free for maximum time only lt li gt lt li gt No insurance lt li gt lt ul gt lt button type button class w btn btn lg btn outline primary gt Sign up for free lt button gt lt div gt lt div gt lt div gt lt div class col gt lt div class card mb rounded shadow sm gt lt div class card header py gt lt h class my fw normal gt Pro lt h gt lt div gt lt div class card body gt lt h class card title pricing card title gt lt small class text body secondary fw light gt mo lt small gt lt h gt lt ul class list unstyled mt mb gt lt li gt Maximum import export lt li gt lt li gt Weight under kg lt li gt lt li gt Priority email support lt li gt lt li gt Insurance included lt li gt lt ul gt lt button type button class w btn btn lg btn primary gt Get started lt button gt lt div gt lt div gt lt div gt lt div class col gt lt div class card mb rounded shadow sm border primary gt lt div class card header py text bg primary border primary gt lt h class my fw normal gt Enterprise lt h gt lt div gt lt div class card body gt lt h class card title pricing card title gt lt small class text body secondary fw light gt mo lt small gt lt h gt lt ul class list unstyled mt mb gt lt li gt Maximum import export lt li gt lt li gt Weight under kg lt li gt lt li gt Phone and email support lt li gt lt li gt Insurance included lt li gt lt ul gt lt button type button class w btn btn lg btn primary gt Contact us lt button gt lt div gt lt div gt lt div gt lt div gt lt div gt Footer SectionThis is the code of the footer section lt div class container gt lt footer class pt my md pt md border top gt lt div class row gt lt div class col col md gt lt svg class mb xmlns width height fill currentColor class bi bi globe americas viewBox gt lt path d M a A ZM c A Z gt lt svg gt lt small class d block mb text body secondary gt lt small gt lt div gt lt div class col col md gt lt h gt Features lt h gt lt ul class list unstyled text small gt lt li class mb gt lt a class link secondary text decoration none href gt Cool stuff lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Random feature lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Team feature lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Stuff for developers lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Another one lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Last time lt a gt lt li gt lt ul gt lt div gt lt div class col col md gt lt h gt Resources lt h gt lt ul class list unstyled text small gt lt li class mb gt lt a class link secondary text decoration none href gt Resource lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Resource name lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Another resource lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Final resource lt a gt lt li gt lt ul gt lt div gt lt div class col col md gt lt h gt About lt h gt lt ul class list unstyled text small gt lt li class mb gt lt a class link secondary text decoration none href gt Team lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Locations lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Privacy lt a gt lt li gt lt li class mb gt lt a class link secondary text decoration none href gt Terms lt a gt lt li gt lt ul gt lt div gt lt div gt lt footer gt lt div gt This is the live version of our website Time to convert the HTML and CSS project to ReactJS project Creating a new ReactJS projectPrerequisite You must have NodeJS installed on your computer or laptop if you have not installed NodeJS yet you can install the LTS version here After installation confirm the installation by running the following commandnode versionThe previous command must output the installed node version on the computer Time to create a ReactJS projectnpx create react app first projectThe previous command creates a react project with the folder name first project in the file hierarchy where you run the previous command If you have a permission related issue you can run the previous command with the sudo like sudo npx create react app first project Time to open it in your favourite code editors After opening you can see the file structure like thatIf you don t understand the file structure don t worry it is completely fine with us because we are beginners We are just starting our web development journey You can open the terminal in your code editor and run this command to start the project npm startAfter this command got executed you will notice a localhost opens in your default web browser and you can see your project running there OKAY Let s understand important files in the file hierarchy index html We have index html in the public folder You can imagine it as index html of our HTML and CSS website The only difference is that the body tag contains only a div with no additional content lt div id root gt lt div gt I strongly recommend you see the file yourself in your code editor You guys are thinking about how our project will work if there is nothing in the div This is a good questionTechnically speaking we are injecting the HTML tags with the help of Javascript Don t worry you don t need to do it manually this is done automatically by ReactJS index js We have index js in the src folder This is responsible for injecting the required HTML to index html App js In simple words it is the UI that we are seeing at localhost We can make changes according to our needs App css The CSS corresponding to App js file Let s start to make changes in App js file and you can remove all the code from App css file import App css function App return lt div gt Hello World lt div gt export default App You can see the changes made by you live at localhost Now time to use the power of ReactJS and use the reusability of code Make a components folder inside the src and from now we will work on this folder Inside Hello jsx write code like thisimport React from react function Hello return lt h gt Hello World lt h gt export default Hello As you know everything is App js so need to import this import Hello from components Hello and use it like this lt Hello gt import App css import Hello from components Hello function App return lt div gt lt Hello gt lt div gt export default App Now you can reuse your Hello world code as many time you want lt div gt lt Hello gt lt Hello gt lt Hello gt lt div gt If you are reading here I appreciated your dedication I highly recommend you to see the index html file of our HTML and CSS website then you can relate the things more easily As you know our website is divided into the following subsection Header Hero Features Pricing and Footer Based on that fact I will create some files in the components folder as follows Header jsxWe are following the same rule for templates for each file I will walk through the Header jsx file and the remaining you can be done it on your own If you have any issues then you can take the reference from the repository here import React from react function Features return lt div gt lt div gt export default Features This is the generalized template where Features JSX file name and the can be of your website section in our case it of these sections Header Hero Features Pricing and Footer The full code is as followsimport React from react function Header return lt div class container gt lt header class d flex flex wrap justify content center py mb border bottom gt lt a href class d flex align items center mb mb md me md auto link body emphasis text decoration none gt lt span class fs gt MarsXport lt span gt lt a gt lt ul class nav nav pills gt lt li class nav item gt lt a href class nav link active aria current page gt Home lt a gt lt li gt lt li class nav item gt lt a href class nav link gt Features lt a gt lt li gt lt li class nav item gt lt a href class nav link gt Pricing lt a gt lt li gt lt ul gt lt header gt lt div gt export default Header Note You have to change class with className in all the places in JSX file You can use a code editor for these things If you are receiving the warning message of multiple attributes with the same name you can ignore it for now It doesn t affect your project As I mentioned above you can imagine index html of the ReactJS project to index html of HTML and CSS projects We also need to add CDN to our ReactJS index html file The code is as follows lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset utf gt lt title gt React App lt title gt lt link href dist css bootstrap min css rel stylesheet integrity sha bw aepP YChEpVNVgiZdgIC VKNBQNGCHeKRQN PtmoHDEXuppvnDJzQIu crossorigin anonymous gt lt head gt lt body gt lt noscript gt You need to enable JavaScript to run this app lt noscript gt lt div id root gt lt div gt lt script src dist js bootstrap bundle min js integrity sha HwwvtgBNobZJJLYdoVXjrBZtcqVSpeBNSnCIVInixGAoxmnlMuBnhbgrkm crossorigin anonymous gt lt script gt lt body gt lt html gt We have completed majority part of our project The last thing is remaining is to add these line of CSS in App css feature icon small width rem height rem You can now check your localhost and here is the live ReactJS project and live HTML amp CSS project You got it You created your first ReactJS project Thanks for reading till the end If you have any feedback the comment section is yours Till then let s grow together CodeContact me ankursingh gmail com LinkedIn Twitter |
2023-08-06 08:44:26 |
ニュース |
BBC News - Home |
Lostprophets' Ian Watkins stabbed in jail - reports |
https://www.bbc.co.uk/news/uk-66419302?at_medium=RSS&at_campaign=KARANGA
|
sentence |
2023-08-06 08:36:20 |
ニュース |
BBC News - Home |
'We can beat everybody' - Netherlands reach quarter-finals |
https://www.bbc.co.uk/sport/football/66414642?at_medium=RSS&at_campaign=KARANGA
|
spain |
2023-08-06 08:12:02 |
ニュース |
BBC News - Home |
England World Cup squad: Steve Borthwick left with plenty to ponder |
https://www.bbc.co.uk/sport/rugby-union/66403527?at_medium=RSS&at_campaign=KARANGA
|
England World Cup squad Steve Borthwick left with plenty to ponderRugby union correspondent Chris Jones examines the decisions facing England coach Steve Borthwick as he prepares to name his World Cup squad |
2023-08-06 08:40:44 |
ニュース |
BBC News - Home |
Open Water Swimming World Cup: Paris 2024 test event cancelled over pollution in Seine |
https://www.bbc.co.uk/sport/swimming/66420677?at_medium=RSS&at_campaign=KARANGA
|
Open Water Swimming World Cup Paris test event cancelled over pollution in SeineThe fourth meet of the Open Water Swimming World Cup is cancelled after water quality in the River Seine is judged to be below acceptable standards |
2023-08-06 08:04:35 |
コメント
コメントを投稿