프로젝트
GitHub에서 보기
lilactown/helix
소개
ClojureScript에서 React를 개발하기 위한 간단하고 사용하기 쉬운 라이브러리입니다.
웹 및 앱측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalHelix
ClojureScript optimized for modern React development.
(ns my-app.core
(:require [helix.core :refer [defnc $]]
[helix.hooks :as hooks]
[helix.dom :as d]
["react-dom/client" :as rdom]))
;; define components using the `defnc` macro
(defnc greeting
"A component which greets a user."
[{:keys [name]}]
;; use helix.dom to create DOM elements
(d/div "Hello, " (d/strong name) "!"))
(defnc app []
(let [[state set-state] (hooks/use-state {:name "Helix User"})]
(d/div
(d/h1 "Welcome!")
;; create elements out of components
($ greeting {:name (:name state)})
(d/input {:value (:name state)
:on-change #(set-state assoc :name (.. % -target -value))}))))
;; start your app with your favorite React renderer
(defonce root (rdom/createRoot (js/document.getElementById "app")))
(.render root ($ app))
Installation
Install the latest version from clojars in your project.
Install JS dependencies:
npm init # initialize NPM project if necessary
npm i react react-refresh # install react, and react-refresh for hot reloading support (see docs)
npm i react-dom # install renderer. alternatives could be react-native, react-three-fiber, etc.
shadow-cljs and react-native
See React Native.
lein-cljsbuild / figwheel-main / raw CLJS
Use CLJSJS or package
react yourself using webpack, ensuring it is provided as the name "react".
Documentation
- Why Helix
- Creating Components
- Creating elements
- Hooks
- Experiments
- Pro-tips
- Frequently Asked Questions
- React Native
Other resources:
Related projects and repos
- Example TodoMVC
- Example repo running tests using testing-library and jsdom
- Examples from the React docs site rewritten in helix
Companies using it
License
Copyright © 2023 Will Acton
Distributed under the EPL 2.0
관련 프로젝트 살펴보기
불러오는 중…