0

I am using RMWC components on my React app and I need to set the font-family of the app based on a API Call but I can't able to find a way to implement it.

I checked this stackoverflow discussion which sets the font-family other than Roboto when the app loads but I need it to set the font-family after an api call.

Sass - Setting the font family with material web components

Can you please suggest me some solution.

Thanks

Olivier Tassinari
  • 8,238
  • 4
  • 23
  • 23
  • Idealy, you'll be setting a flag to evaluate the desired component's classname. e.g. The flag is an attribute in the state called `changeFont: false`, which becomes `true` after calling the API, and in the `render` method of your component, evaluate the value of `this.state.changeFont` to give a proper `className` property for the desired component. – Sultan H. Jul 10 '19 at 10:54
  • This is how we do with our React components but the issue is related to the React Material Web Components (RMWC) - https://rmwc.io/ – Karthikeyan Balasubramanian Jul 10 '19 at 11:56
  • can you show an example of this case using [codesandbox](https://codesandbox.io/s/) – Sultan H. Jul 10 '19 at 11:58

0 Answers0