At the moment I decided to update it manually, but now I'm really looking to react.
Yesterday did a crash course into React and was very exited about it.
Below are some takeaways
Boilerplate:
Page can be seen as combination of different parts, like header, footer, container, table in container, row in the table.
These parts are components. Components can be either functional or class. Functional componets used to be very limiting, but now with react hooks functionality can be the same.
For the purpose of the tutorial functional components were used. Functional componets are easily created by 'rafce' abbreviation in VS code.
Passing variable:
To pass variable or function to component simply add it to tag, for examle: <Header title = 'Task tracker' /> will pass variable title with content 'Task tracker'
To access it simply wrap it in curly braces: <h1>{title}</h1>
Variable type in component:
As javascript doesn't allow direct set up of variable type, there is solution to ensure variable passed to component is of a right type.
import PropTypes from 'prop-types'
Button.defaultProps = {
color: 'steelblue',
}
Button.propTypes = {
text: PropTypes.string,
color: PropTypes.string,
onClic: PropTypes.func,
}
States:import { useState } from 'react'
- imports state from reactconst [tasks, setTasks] = useState([])
- sets up default state
Was investigating alternative ways to host website. The reasons are following:
I started learn CSS when HTML 4.0 was a new thing and remember some strict requirements that were advised by
our teachers, like using CAPITAL letters for html tags, otherwise there was a penalties when submitting work.
I haven't really explored CSS a lot ever since, and frankly, was quiet impressed how things are done nowadays.
Saving tutorial for responsive grid to future self,
because I'm definetly keen to learn more about modern practices.
Finished setting up CDN, upgrade the look.
To be honest, not really happy about how it looks now, but hey! It's something
Site setup, hosted on Azure, https using CDN. Thanks to this blog