Diff
checker
Texto
Texto
Imagens
Documentos
Excel
Pastas
Legal
Enterprise
Aplicativo para desktop
Preços
Fazer login
Baixar o Diffchecker Desktop
Comparar texto
Encontre a diferença entre dois arquivos de texto
Ferramentas
Histórico
Editor live
Recolher inalteradas
Sem quebra de linha
Layout
Dividido
Unificado
Nível de detalhe
Inteligente
Palavra
Caractere
Realce de sintaxe
Escolher sintaxe
Ignorar
Transformar texto
Ir à primeira mudança
Editar entrada
Diffchecker Desktop
A maneira mais segura de usar o Diffchecker. Obtenha o aplicativo Diffchecker Desktop: seus diffs nunca saem do seu computador!
Obter Desktop
chicago ward map with props callback
Criado
há 5 anos
O diff nunca expira
Limpar
Exportar
Compartilhar
Explicar
2 remoções
Linhas
Total
Removido
Caracteres
Total
Removido
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
53 linhas
Copiar tudo
3 adições
Linhas
Total
Adicionado
Caracteres
Total
Adicionado
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
51 linhas
Copiar tudo
Copiar
Copiado
Copiar
Copiado
function ChicagoWardMap(
) {
function ChicagoWardMap(
{ selectWard }
) {
const [wardBorders, setWardBorders] = useState(null)
const [wardBorders, setWardBorders] = useState(null)
Copiar
Copiado
Copiar
Copiado
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
Copiar
Copiado
Copiar
Copiado
const layerFeature = layer?.feature?.properties
const layerFeature = layer?.feature?.properties
? layer.feature.properties
? layer.feature.properties
: null
: null
Copiar
Copiado
Copiar
Copiado
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>
Copiar
Copiado
Copiar
Copiado
{ward && <p>Ward {ward.ward}'s shape_area = {ward.shape_area} and shape_leng = {ward.shape_leng}</p>}
</>
</>
)
)
}
}
export default ChicagoWardMap
export default ChicagoWardMap
Diferenças salvas
Texto original
Abrir arquivo
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
Texto alterado
Abrir arquivo
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
Encontrar Diferença