-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotes.txt
49 lines (32 loc) · 2.04 KB
/
Notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# /node_modules in .gitignore file -> will only ignore node_modules in current directory(means '/')
-> if we want to avoid all node_modules(even in backend and other folders if there)
-> we need to update it to "node_modules" insted of "/node_modules"
# Cors-Cross Origin Resource Sharing
must be used to mention the backend -> from which url or addresses you can accept requests
# e.preventDefault() blocks the default nature of selected component
-> for example on click a button refreshes the page
-> in order to prevent this behaviour you can use preventDefault
# place edit model in parent component
-> make launch demo model display none
-> use useRef's to manage clicks of toggle(hidden launch demo button)
-> and pass update function to toggle button(launch demo button) and get details of that particular note
as a prop to each child note
-> final setup -> function to update and model code in parent component and just fucntion call is done
from child component as we have passed this function to each child as a prop.
# scroll to note fucnction :-
-> pass ref to each note while iterating in map funciton -> with some unique ref to each note
-> here we have done like this he syntax noteRef={(el) => noteRefs.current[note._id] = el}
is used to dynamically assign a ref to a specific DOM element for each note,
allowing you to access and manipulate the DOM nodes directly in React functional components.
-> The syntax (el) => noteRefs.current[note._id] = el is a callback ref. It takes the DOM element (el) rendered by the component
and stores it in the noteRefs.current object with the key as the note’s unique _id.
-> el refers to the actual DOM element
->For example, if the note has an _id of 123,
then the corresponding DOM element will be stored as noteRefs.current['123'].
-> this is how they are stored
-> (note's id --- DOM of that note)
current
:
66f83b1db7bd5ca582ec0993: div.col-md-3
66f988e43b5cf95c453d991c: div.col-md-3 and soo onnnnn.....
-> note's id and corresponding DOM element of that note is stored in noteRefs object