In React's terminology, there are five core types that are important to distinguish:
React Elements
var React = require('react'); | |
require('node-jsx').install(); | |
var MyApp = React.createFactory( require('./myApp') ); | |
var app = new MyApp({items:['a', 'b', 'c']}); | |
var str = React.renderToString( app ); | |
console.log( 'str: ', str, '\n\n\n', app ); |
1. remoteMethod 如何控管存取權限? | |
- 用 beforeRemote 與 afterRemote hook 做檢查 | |
- 通常我偏好在 beforeRemote hook 做,原因: | |
- 可前期過濾與檢查用戶傳來的參數,例如刪掉格式不正確的內容,或強制塞入指定的參數 | |
- 可精準組合 query 指令,避免撈出多餘的資料 | |
- 如果用 after hook | |
- 就是先撈出所有資料,在返還給客戶端前刪掉不屬於該員的筆數 |
// 定義 remote method | |
loopback.remoteMethod( | |
Document.findAll, | |
{ | |
description: 'Find all folder and sub-folders for a user', | |
accepts: [ | |
// 注意這裏指定從 req.query 裏取值,這是最彈性的方式了 |
// var convert = require('css-to-radium'); | |
// var fs = require('fs'); | |
// var path = require('path'); | |
// var css = fs.readFileSync( path.resolve('./', 'app.css'), 'utf8'); | |
// var result = convert(css); | |
// console.log( '\nresult: \n', require('util').inspect( result, false, 2, true) ); | |
// 模擬 css 轉換後的 js 物件,要將 .foo 轉成 foo | |
var o = { | |
'.foo': 'barr', |
var webdriverio = require('webdriverio'); | |
var options = { | |
desiredCapabilities: { | |
browserName: 'chrome' | |
}, | |
host: '127.0.0.1', | |
port: 8888, | |
waitforTimeout: 10*1000, | |
coloredLogs: true, | |
logLevel: 'verbose' // verbose, silent, command, data, result |
In React's terminology, there are five core types that are important to distinguish:
React Elements
2015-01-29 Unofficial Relay FAQ
Compilation of questions and answers about Relay from React.js Conf.
Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.
Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).
# Overview | |
- GraphQL | |
- 是 query language | |
- 也是一份規格 | |
- GraphQL engine | |
- spec 的實作 | |
- 已有多種語言版本的實作(FB 官方提供 js 實作) |
# 十月技術匯報 | |
- GraphQL/Relay release | |
- http://facebook.github.io/relay/docs/getting-started.html#content | |
- Redux v1 | |
- http://rackt.github.io/redux/ | |
- React 0.14 beta3 |
- 我想要挑戰isomorphic,但目前好像比較少redux配isomorphic又配上webpack的方案 | |
- 這個範例可看,最近全部改寫過 | |
- https://github.com/coodoo/react-redux-isomorphic-example | |
- 注意下面幾點 | |
- js/bootClient.js 與 js/bootServer.js | |
- bootServer.js 負責做 server-render |