A data model is a diagram of data the application or system will use, and how it will flow. It includes a representation of the relationship between elements as well as include entity types, attributes, relationships, integrity rules, and the definitions of those objects.
A framework is going to typically have rules associated with it. A library will also have some rules but with more flexability. They are both going to contain pre-written functionality. When you call to a peice of code then it means you are calling to a library. When code calls to you (your code) then it is framework.
It's a good idea to use a framework so that keeping the UI up to date with the state is easier. With it the UIs are guaranteed to be in sync with the internal state of the application by watching for state changes and re-rendering the whole component. It is not possible to write complex, efficient and easy to maintain UIs with Vanilla JavaScript.
Components are the building blocks of react. It includes a combination of HTML, CSS, JS, and internal data that are all talking to eachother for a specific module. The data of the component will be either be contained in the component itself or the parent component. Each component has the ability to manage its own state and pass its state down to child components if needed.
Create a component using React.Component
Every component is required to have a render method because render discribes the UI of the component.
- the
render()
function can only return a single node, so in case you want to return 2 siblings, just add a parent with any tag
JSX (Stands for JavaScript XML) allows us to write HTML like syntax which gets transformed to lightweight JavaScript objects.
A prop is the data which is passed to the child component from the parent component.
A state in React is the internal data store (object) of a component.
Parent components pass action handlers into their children. The child component can invoke this handler in response to any event it chooses, so the child determines the action, but the parent determines how the action is handled.