Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

Commit

Permalink
Step 2: setting up a new search instance with a basic search
Browse files Browse the repository at this point in the history
  • Loading branch information
colbyfayock committed May 24, 2020
1 parent 54720da commit adbf30a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ import Fuse from 'fuse.js';
import characters from './characters.json';

function App() {
console.log('Fuse', Fuse)
const fuse = new Fuse(characters, {
keys: [
'name',
'company',
'species'
],
includeScore: true
});

const results = fuse.search('bender');
const characterResults = results.map(character => character.item);

return (
<>

Expand All @@ -17,7 +28,7 @@ function App() {

<main className="container">
<ul className="characters">
{characters.map(character => {
{characterResults.map(character => {
const { name, company, species, thumb } = character;
return (
<li key={name} className="character">
Expand Down

0 comments on commit adbf30a

Please sign in to comment.