-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #311 from oslabs-beta/master
Reactime 19 release!
- Loading branch information
Showing
227 changed files
with
2,768 additions
and
18,448 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
{ | ||
"presets": [ | ||
"airbnb" | ||
], | ||
"presets": ["airbnb", "@babel/preset-typescript"], | ||
"plugins": ["@emotion"] | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
2 changes: 1 addition & 1 deletion
2
demo-app-next/src/components/navbar.js → demo-app-next/src/components/navbar.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
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
import "../../styles/style.css"; | ||
import React from "react" | ||
|
||
export default function MyApp({ Component, pageProps }): JSX.Element { | ||
return <Component {...pageProps} />; | ||
} |
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
3 changes: 2 additions & 1 deletion
3
demo-app-next/src/pages/index.js → demo-app-next/src/pages/index.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
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
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
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
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
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
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,61 @@ | ||
import React, {useState, createContext} from 'react'; | ||
import IncrementWithMoreHooks from './IncrementWithMoreHooks'; | ||
|
||
/** | ||
* This component as well as IncrementWithMoreHooks were made to show where data for different | ||
* hooks show up in the react fiber tree. | ||
*/ | ||
|
||
/** | ||
* This file is a JSX file, not a TSX file, on purpose. The code won't be converted to common JS | ||
* before being bundled by webpack. There were some errors that weren't showing up for the other | ||
* Increment.tsx file based on how webpack uglifies ES6 files. Maintaining this as a JSX file | ||
* will help check for these types of issues. | ||
*/ | ||
|
||
/** | ||
* How Reactime extracts useState data and what would have to be done | ||
* to extract useContext and useReducer data: | ||
* | ||
* When extracting a functional component's useState data from the fiber tree in the backend of | ||
* Reactime, said data is stored on said component's fiber tree node at its memoizedState property, | ||
* which is a linked list with each node holding data for each useState invocation (some but | ||
* not all other hooks also store nodes with data here). Each useState memoizedState node includes | ||
* the variable (e.g. user) and its corresponding dispatch function (e.g. setUser). This dispatch | ||
* function is required to use Reactime's timeJump feature. | ||
* | ||
* useContext data is stored on the property "dependencies", and only the data passed into the | ||
* value attritibute of the 'context'.Provider element will be there. For tripContext.Provider, | ||
* we pass down "trip" without "setTrip", so we won't have access to the 'trip' dispatch function | ||
* in the "IncrementWithMoreHooks" component, meaning Reactime's timeJump won't work without | ||
* finding the 'trip' dispatch function by coming into this component where useState was invoked and | ||
* storing it in the appropriate place. This is easy enough for useState variables, but useContext | ||
* is commonly used with useReducer which is an entirely different beast. | ||
* | ||
* I advise solving the puzzle of making useReducer work with the timeJump functionality before | ||
* integrating other hooks. Look at time jumping in the Redux dev tools chrome extension for | ||
* inspiration, because you essentially need to recreate that within Reactime. | ||
*/ | ||
|
||
// userInCreateContext is different from 'user' to see where this variable name showed up in the AST | ||
export const userContext = createContext({ userInCreateContext: 'null', setUser: undefined }); | ||
export const tripContext = createContext({ trip: 'null', setTrip: undefined }); | ||
|
||
const ButtonsWithMoreHooks = () => { | ||
const [user, setUser] = useState('null'); | ||
const userValue = { user, setUser }; | ||
const [trip, setTrip ] = useState('Hawaii'); | ||
const tripValue = { trip }; | ||
|
||
return ( | ||
<div className='buttons' key='increment container'> | ||
<userContext.Provider value={userValue} key="userContext Provider"> | ||
<tripContext.Provider value={tripValue} key="tripContext Provider"> | ||
<IncrementWithMoreHooks key={'IncrementWithMoreHooks'} /> | ||
</tripContext.Provider> | ||
</userContext.Provider> | ||
</div> | ||
); | ||
} | ||
|
||
export default ButtonsWithMoreHooks; |
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
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
Oops, something went wrong.