A library for building user interfaces
N/A
Reusable module that renders a part of an overall app. They can be big or small but are clearly defined and serve a single obvious purpose Rules: Use pascal case for functions ex) App, List, AcceptButton
- Component props: A means of passing data into a React component. Props can only be passed from parent components down to child components. Flow of data is unidirectional.
- Attributes: just like HTML attirbutes but different name at times because reserved words in JS **********
Import
Function
Export: makes function/COMPONENT available to other modules- Event: Handle user interactions like clicks, hover, drag bu responding to them and listening to them with built in Event handlers:
onClickonChange. - Functional: Use functions and react hooks (ex.
useStateuseEffect) for state and lifecycle methods - Class: Have state and lifecycle methods built-in. State is declared and uses this to reference it.
**********
Special functions that make components simpler to use by allowing you to keep components cleaner and reuse logic more easily.
useStateAdd local state to functional components.
const [name,setName] = useState('');
name = State Variable that holds the current value
setName = updates the stateuseEffectUse lifecycle methods like mounting, updating, and cleanup.useContextAccess context in a simple way.useRefAccessing and modifying DOM elements across renders. Does not trigger a Re-render.
React component have a life cycle, which consists of three phases:
- Mounting, that is putting inserting elements into the DOM.
- Updating, which involves methods for updating components in the DOM.
- Unmounting, that is removing a component from the DOM.
Document Object Model. A structure that represents the Web page's HTML
Render elements into the DOM
import ReactDOM from 'react-dom';
const App = () => {
return <h1>Hi</h1>;
};
ReactDOM.render(<App />, document.querySelector('#root'));Renders reach elements into the dom
- Controlled Element: Value is controlled by the state and is always connected to the component state.
display preformatted text
**********
This file sets up the basic structure for all pages in the Next.js app.
This file sets up the basic css structure for all pages in the Next.js app.
UI that can be rendered and optionally cached on the server **********
install show all containers
**********
-
**********
Entry point of app
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client' //Finds the specified element where React will inject the app
import './index.css'
import App from './App.jsx'
//.render() Tells React what to display inside the "root element"
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)
What does the config do
Config example and definition of each term
**********
- steps
- step
- step
**********