Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
chicago ward map with props callback
作成日
5 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
2 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
53 行
すべてコピー
3 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
51 行
すべてコピー
コピー
コピー済み
コピー
コピー済み
function ChicagoWardMap(
) {
function ChicagoWardMap(
{ selectWard }
) {
const [wardBorders, setWardBorders] = useState(null)
const [wardBorders, setWardBorders] = useState(null)
コピー
コピー済み
コピー
コピー済み
const [ward, setWard] = useState(null)
useEffect(() => {
useEffect(() => {
// get the geojson
// get the geojson
fetch('https://raw.githubusercontent.com/datamade/chicago-judicial-elections/master/wards/wards_2012.geojson')
fetch('https://raw.githubusercontent.com/datamade/chicago-judicial-elections/master/wards/wards_2012.geojson')
.then((res) => res.json()) // parse the response into json
.then((res) => res.json()) // parse the response into json
.then((geojson) => {
.then((geojson) => {
setWardBorders(geojson) // with the geojson, set the state for wardBorders
setWardBorders(geojson) // with the geojson, set the state for wardBorders
})
})
}, [setWardBorders])
}, [setWardBorders])
const fill = {
const fill = {
fillColor: '#daf0ce',
fillColor: '#daf0ce',
weight: 0.5,
weight: 0.5,
opacity: 0.4,
opacity: 0.4,
color: '#666',
color: '#666',
fillOpacity: 0.5
fillOpacity: 0.5
}
}
function onWardClick(e) {
function onWardClick(e) {
const layer = e.target
const layer = e.target
コピー
コピー済み
コピー
コピー済み
const layerFeature = layer?.feature?.properties
const layerFeature = layer?.feature?.properties
? layer.feature.properties
? layer.feature.properties
: null
: null
コピー
コピー済み
コピー
コピー済み
se
tWard(layerFeature)
se
lec
tWard(layerFeature)
}
}
function eventHandlersOnEachFeature(feature, layer) {
function eventHandlersOnEachFeature(feature, layer) {
layer.on({
layer.on({
click: onWardClick
click: onWardClick
})
})
}
}
return (
return (
<>
<>
<BaseMap center={[41.8781, -87.6298]} zoom={10}>
<BaseMap center={[41.8781, -87.6298]} zoom={10}>
{/* this will only show when wardBorders has a value */}
{/* this will only show when wardBorders has a value */}
{wardBorders && <GeoJSON
{wardBorders && <GeoJSON
key='ward-layer'
key='ward-layer'
data={wardBorders}
data={wardBorders}
style={fill}
style={fill}
onEachFeature={eventHandlersOnEachFeature} />}
onEachFeature={eventHandlersOnEachFeature} />}
</BaseMap>
</BaseMap>
コピー
コピー済み
コピー
コピー済み
{ward && <p>Ward {ward.ward}'s shape_area = {ward.shape_area} and shape_leng = {ward.shape_leng}</p>}
</>
</>
)
)
}
}
export default ChicagoWardMap
export default ChicagoWardMap
保存された差分
原文
ファイルを開く
function ChicagoWardMap() { const [wardBorders, setWardBorders] = useState(null) const [ward, setWard] = useState(null) useEffect(() => { // get the geojson fetch('https://raw.githubusercontent.com/datamade/chicago-judicial-elections/master/wards/wards_2012.geojson') .then((res) => res.json()) // parse the response into json .then((geojson) => { setWardBorders(geojson) // with the geojson, set the state for wardBorders }) }, [setWardBorders]) const fill = { fillColor: '#daf0ce', weight: 0.5, opacity: 0.4, color: '#666', fillOpacity: 0.5 } function onWardClick(e) { const layer = e.target const layerFeature = layer?.feature?.properties ? layer.feature.properties : null setWard(layerFeature) } function eventHandlersOnEachFeature(feature, layer) { layer.on({ click: onWardClick }) } return ( <> <BaseMap center={[41.8781, -87.6298]} zoom={10}> {/* this will only show when wardBorders has a value */} {wardBorders && <GeoJSON key='ward-layer' data={wardBorders} style={fill} onEachFeature={eventHandlersOnEachFeature} />} </BaseMap> {ward && <p>Ward {ward.ward}'s shape_area = {ward.shape_area} and shape_leng = {ward.shape_leng}</p>} </> ) } export default ChicagoWardMap
変更されたテキスト
ファイルを開く
function ChicagoWardMap({ selectWard }) { const [wardBorders, setWardBorders] = useState(null) useEffect(() => { // get the geojson fetch('https://raw.githubusercontent.com/datamade/chicago-judicial-elections/master/wards/wards_2012.geojson') .then((res) => res.json()) // parse the response into json .then((geojson) => { setWardBorders(geojson) // with the geojson, set the state for wardBorders }) }, [setWardBorders]) const fill = { fillColor: '#daf0ce', weight: 0.5, opacity: 0.4, color: '#666', fillOpacity: 0.5 } function onWardClick(e) { const layer = e.target const layerFeature = layer?.feature?.properties ? layer.feature.properties : null selectWard(layerFeature) } function eventHandlersOnEachFeature(feature, layer) { layer.on({ click: onWardClick }) } return ( <> <BaseMap center={[41.8781, -87.6298]} zoom={10}> {/* this will only show when wardBorders has a value */} {wardBorders && <GeoJSON key='ward-layer' data={wardBorders} style={fill} onEachFeature={eventHandlersOnEachFeature} />} </BaseMap> </> ) } export default ChicagoWardMap
違いを見つける