Socratic React NJ Test 001

  • Q: Does Nextjournal allow for creation and rendering of React components? If yes, how so?

After a few experiments, I have yet to actualize tangible results of cross cell function access...

I am now thinking I may have to manually save a function into cache, local storage, or the document or window perhaps.

// Q001: What do I need in a Nextjournal document to display/render React elements?
//   - Q: What are the valid cell types for rendering React components from a Nextjournal doc?
function hello() {
  console.log("hi!");
};
// hello();
// console.log({hello});
window.custom1 = hello;
document.custom2 = hello;
console.log("1", window["custom1"]);
console.log("2", document["custom2"]);
// - [ ] Q: Where is the `hello` function stored?
// - [ ] Q: Can I access the hello function outside of the cell it was defined in?
//hello();
// goog.object
console.log({window});
console.log(a);
console.log({document});
console.log(window[custom1]);
console.log(document[custom2]);
function hello2() {
  console.log("hey!");
};
//Save Data to Local Storage
//localStorage.setItem(key, value);
//Read Data from Local Storage
//let lastname = localStorage.getItem(key);
localStorage.setItem("func2", hello2);
const newFunc2 = () => localStorage.getItem("func2");
newFunc2();

Q: How does one reconstitute (rehydrate?) a function from an object?

Runtimes (1)