Skip to content

Instantly share code, notes, and snippets.

View Hydrock's full-sized avatar

Alex Vechkanov Hydrock

View GitHub Profile
@Hydrock
Hydrock / notion2Habitica.py
Created May 8, 2022 17:26 — forked from gauchy/notion2Habitica.py
Notion to Habitica Sync tool
import requests, json
token = 'XXX'
databaseId = 'XXX'
headers = {
"Authorization": "Bearer " + token,
"Content-Type": "application/json",
"Notion-Version": "2021-05-13"
npm install react@alpha react-dom@alpha
const App = () => {
return (
<Suspense fallback={<Loading />}>
<SuspendedComponent />
<Sibling />
</Suspense>
);
};
import { Suspense, SuspenseList } from "react";
const App = () => {
return (
<SuspenseList revealOrder="forwards">
<Suspense fallback={"Loading..."}>
<ProfilePicture id={1} />
</Suspense>
<Suspense fallback={"Loading..."}>
<ProfilePicture id={2} />
import { useDeferredValue } from "react";
// ...
const [text, setText] = useState("text");
const deferredText = useDeferredValue(text, { timeoutMs: 2000 });
const App = () => {
// ...
const [isPending, startTransition] = useTransition({ timeoutMs: 2000 });
startTransition(() => {
setSearchQuery(input);
});
// ...
import { startTransition } from "react";
// ...
// Urgent -> show updated input
setInputValue(input);
// Transition (non-urgent) -> show search
startTransition(() => {
setSearchQuery(input);
// Old
ReactDOM.hydrate(<App />, container);
// New
const root = ReactDOM.createRoot(container, { hydrate: true });
root.render(<App />);
// Old
ReactDOM.render(<App />, container, () => console.log("renderered"));
// New
const App = ({ callback }) => {
return (
<div ref={callback}>
<h1>Hello World</h1>
</div>
);
import ReactDOM from "react-dom";
import App from "App";
const container = document.getElementById("app");
// Old
ReactDOM.render(<App />, container);
// New
const root = ReactDOM.createRoot(container);