From ebb535b7406837fbb1b1bc07b09aa4e8991f4005 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Mon, 5 Feb 2024 04:41:32 +0530 Subject: Adds Notes and Code Examples * Move Notes to separate file * Adds Code Examples --- src/notes/state.notes.svelte | 38 +++++++++++++++++++++ src/slides.svelte | 79 ++++++++++++++++++++++++-------------------- 2 files changed, 82 insertions(+), 35 deletions(-) create mode 100644 src/notes/state.notes.svelte diff --git a/src/notes/state.notes.svelte b/src/notes/state.notes.svelte new file mode 100644 index 0000000..bde0f65 --- /dev/null +++ b/src/notes/state.notes.svelte @@ -0,0 +1,38 @@ + + + + \ No newline at end of file diff --git a/src/slides.svelte b/src/slides.svelte index 64166a8..c4a3d70 100644 --- a/src/slides.svelte +++ b/src/slides.svelte @@ -9,6 +9,7 @@ Code } from '@components' import { signal } from '@motion' + import StateNotes from "./notes/state.notes.svelte" const circle = signal( { x: 0, y: 200, r: 80, fill: '#00ffff' }, @@ -83,41 +84,49 @@

useState()

- - - +
+ + {` + import React, {useState} from 'react'; + + const [value, setValue] = useState(null); + `} + +
+ +
+ +

useState()

+
+ + {` + import React, {useState} from 'react'; + + const [value, setValue] = useState({ + id: 12, + name: "YouName" + }) + `} + +
+ +
+ +

useState()

+
+ + {` + import React, {useState} from 'react'; + + function calculateValue() { + return Math.sqrt(64); + } + + const [value, setValue] = useState(calculateValue()); + `} + +
+

Side Effects

-- cgit v1.2.3