Fork me on GitHub
#reagent
<
2020-09-19
>
joshkh10:09:59

i'm trying to implement this very basic example of using https://baseweb.design/guides/theming#default-themes

import React from 'react';
import {LightTheme} from 'baseui';
import { Button } from "baseui/button";

 export default function App() {
  return (
    <ThemeProvider theme={LightTheme}>
      I can use themed Base Web components here!
      <Button>Hello</Button>
    </ThemeProvider>
  );
}
with reagent:
(ns app.view
  (:require ["baseui" :refer [LightTheme ThemeProvider]]
            ["baseui/button" :refer [Button]]))

(defn app []
  [:> ThemeProvider {:theme LightTheme}
   "I can use themed Base Web components here!"
   [:> Button "Hello"]])
everything compiles fine, and i see the Button component as a button, but the theme LightTheme should be applied to all descendant components of ThemeProvider which is not happening. can anyone spot something wrong with my syntax before i continue digging into BaseUI itself?

lispers-anonymous20:09:16

This may be a simple question that has been addressed before, but I'm having trouble finding an answer online. Is it safe to deref a reagent atom or reaction outside of a component? I know there are concerns with using re-frame subscriptions outside components and that causing a memory leak, but I think that is specific to the re-frame subscription caching. Are there similar concerns for plain reagent atoms?

p-himik20:09:53

AFAIK it's fine. There are specific checks for that.

🙏 1