How to use fre - 10 common examples

To help you get started, we’ve selected a few fre examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yisar / fre / demo / router / index.js View on Github external
export function useRoutes (routes) {
  const [rid] = useState(Math.random().toString())
  const setter = useState(0)[1]

  let stackObj = stack[rid]

  if (!stackObj) {
    stackObj = {
      routes: Object.entries(routes),
      setter
    }

    stack[rid] = stackObj
    process(rid)
  }

  console.log(stackObj.component(stackObj.props))

  return typeof stackObj.component === 'function'
github yisar / fre / demo / router / index.js View on Github external
export function useRoutes (routes) {
  const [rid] = useState(Math.random().toString())
  const setter = useState(0)[1]

  let stackObj = stack[rid]

  if (!stackObj) {
    stackObj = {
      routes: Object.entries(routes),
      setter
    }

    stack[rid] = stackObj
    process(rid)
  }

  console.log(stackObj.component(stackObj.props))
github yisar / fre / demo / useContext.js View on Github external
import { useContext, Context, render, h } from 'fre'

function App () {
  const context = useContext(Context)
  return <main>{context}</main>
}

render(
  
    
  ,
  document.body
)
github yisar / fre / demo / doc / index.js View on Github external
<p align="center">
          <img width="180" alt="fre logo" src="http://wx2.sinaimg.cn/mw690/0060lm7Tly1ftpm5b3ihfj3096097aaj.jpg">
        </p>
        <h1 align="center">Fre</h1>
        <h3 align="center">Fast 1kb React-like hooks API js library</h3>
      
      <div class="wrap">
    </div>
  )
}

render(, document.body)
github frejs / use-routes / src / index.js View on Github external
export function useRoutes(routes) {
  const id = useState(Symbol())[0]
  const setter = useState(0)[1]

  let stack = {
    routes: Object.entries(routes),
    setter
  }

  routeStack[id] = stack
  perfrom(id, true)

  return typeof stack.component === 'string'
    ? push(stack.component)
    : stack.component(stack.props)
}
github frejs / use-routes / src / index.js View on Github external
export function useRoutes(routes) {
  const id = useState(Symbol())[0]
  const setter = useState(0)[1]

  let stack = {
    routes: Object.entries(routes),
    setter
  }

  routeStack[id] = stack
  perfrom(id, true)

  return typeof stack.component === 'string'
    ? push(stack.component)
    : stack.component(stack.props)
}

fre

Tiny Concurrent UI library with Fiber.

MIT
Latest version published 1 year ago

Package Health Score

48 / 100
Full package analysis