Skip to content

kauppilainen/react-cljs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Why?

Allow users to run Squint, a ClojureScript dialect, in their React project.

How?

react-cljs exposes two things:

  • a setup script that installs react-cljs as a dev dependency and inserts a script into package.json called cljs-repl that spins up a Squint REPL
  • a Vite plugin utilising Squints compileString to transpile ClojureScript to JavaScript.

Usage

Working example

> npm create vite@latest react-cljs-test -- --template react
> cd react-cljs-test
> npx react-cljs setup

Then add cljsToJs to your plugins list in vite.config.js

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { cljsToJs  } from 'react-cljs'

export default defineConfig({
  plugins: [cljsToJs(), react()],
})

One can now freely drop .cljs files into their React project and import its functions as any other JavaScript function

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published