Customised palette in React

Hi, I am looking to create a custom palette in React. From what I read in forums, I need to create a new CustomPaletteProvier (like the existing lib/features/palette/PaletteProvider.js) . However, I am not sure how to get the “palette” or the “elementFactory” objects injected into my react function component. Would appreciate any help around this. Thanks