It's easier to set up than you would think, and it might save you literally many, many hours per week. If you want to set up PrivyJS with your project, there are a couple of steps to go through. To be honest, right now, it's not the smoothest experience, unfortunately. Unless you use Create React App or something super simple, in which case it should hopefully just work out of the box.
The first thing is make sure that you use an IDE that is compatible, so either Visual Studio Code or IntelliJ slash WebStorm. If you are not sure which one to use, use Visual Studio Code because the IntelliJ version is kind of buggy, to be honest. Working on that.
And then the next thing is you have to configure it to display your components properly, because by default, what PreviewJS will do is just display the component in a completely empty app, which is not exactly perfect. If, for example, you need some global CSS to be there. The way that you do that is by configuring a wrapper component. And let me show you what that looks like in my hungry app. It's here previewjs.wrapper.tsx, and that's pretty much all the config that we have. That's it, that's all the config. The important thing here is this import styles.globals.css. Without this, it would look super ugly, so let me just show you what I mean. Okay, so I have this, and I'm gonna remove that just for fun. And it's gonna be, yep, really broken. Because, of course, in globals or TSS, in this case, I have all of Tailwind set up. And I also have a wrapper that sets up a screen container, so I'm just adding a little bit of margin to make it prettier. But you might, for example, need to set some react context, some, you know, initialize your redux state, or whatever else you need. And if you use aliases, you know, import aliases, you might also need a couple of lines of config as well.
As I mentioned earlier, PrivyJS is quite new, it just came out in January. So, if you run into any bugs, please consider reporting them on GitHub. I'd really appreciate that. I'm expecting after this talk maybe a couple of hundred bug reports. Hopefully not that many. Go to PrivyJS.com if you want to check it out. If you're on Twitter, you can follow me and share your feedback. I really hope that PrivyJS can make your daily workflow a little bit better and a little bit faster.
Comments