jaredpalmer / formik-docs

WIP. Formik docs website
MIT License
2 stars 0 forks source link

Better way to load examples? #1

Open jaredpalmer opened 6 years ago

jaredpalmer commented 6 years ago

Is there a better way to load up my examples as both a string and jsx? like with a fancy gatsby layout template?

https://github.com/jaredpalmer/formik-docs/blob/master/src/pages/examples/async-validation.tsx#L3-L4

jaredpalmer commented 6 years ago

@KyleAMathews

KyleAMathews commented 6 years ago

That seems pretty sensible actually. The only way I could see to make it fancier is you had a webpack loader which did the prism highlighting at build time to avoid loading prism into the browser though I don't think prism is that big.

What exactly were you thinking by "fancy gatsby layout template"? Like something that abstracts the individual pages? Ok, I see now :-) yeah, you could have one template component for all the example pages and require all the examples into that and then render the right one based on the page you're on. Gatsby's way of creating lots of pages based on one template and injecting in needed data for each page has the big weakness that you can't (yet... gonna figure out a great solution someday) inject unique modules.