-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add jotai State Management (#1)
# Story Title [Use Jotai as the state management](https://app.clickup.com/t/86epj20qp) ## Changes made - Install Jotai - Add Jotai Provider to Organism.Wrapper; Remove Redux Provider - Add Page to test Jotai atoms ## How does the solution address the problem This PR will update the state management to use Jotai instead of Redux.
- Loading branch information
1 parent
7a7c639
commit 35a4f05
Showing
5 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"use client"; | ||
import { atom } from "jotai"; | ||
|
||
export const msgAtom = atom("hello world"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
import { useAtom } from "jotai"; | ||
import { msgAtom } from "../_data/atoms"; | ||
import { useState } from "react"; | ||
|
||
export default function JotaiExamplePage() { | ||
const [msg, setMsg] = useAtom(msgAtom); | ||
const [input, setInput] = useState(""); | ||
|
||
return ( | ||
<div> | ||
<h1>{msg}</h1> | ||
<form | ||
onSubmit={(e) => { | ||
e.preventDefault(); | ||
setMsg(input); | ||
}} | ||
> | ||
<input | ||
className="border" | ||
onChange={(e) => { | ||
setInput(e.target.value); | ||
}} | ||
type="text" | ||
/> | ||
<button type="submit">submit</button> | ||
</form> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters