-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: adding failing test * Update packages/core/src/__tests__/builder.test.ts --------- Co-authored-by: Steve Sewell <[email protected]>
- Loading branch information
1 parent
bd9c123
commit fae4687
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/core/src/__tests__/data/blocks/index-in-for.raw.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useState } from '@builder.io/mitosis'; | ||
|
||
export default function MyComponent(props) { | ||
const [todos, setTodos] = useState([ | ||
{ id: 1, completed: false }, | ||
{ id: 2, completed: false }, | ||
]); | ||
|
||
return ( | ||
<div> | ||
{todos.map((todo) => ( | ||
<div> | ||
{state.todos.map((todo) => ( | ||
<input | ||
type="checkbox" | ||
checked={todo.completed} | ||
onChange={(event) => { | ||
const index = state.todos.findIndex((t) => t.id === todo.id); | ||
state.todos[index].completed = event.target.checked; | ||
}} | ||
/> | ||
))} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |