mirror of
https://github.com/bendtherules/some-hooks.git
synced 2026-08-18 13:52:05 +00:00
prettier - Format existing files with prettier
This commit is contained in:
+6
-10
@@ -1,13 +1,9 @@
|
|||||||
import React from 'react'
|
import React from "react";
|
||||||
|
|
||||||
import { useMyHook } from 'some-hooks'
|
import { useMyHook } from "some-hooks";
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const example = useMyHook()
|
const example = useMyHook();
|
||||||
return (
|
return <div>{example}</div>;
|
||||||
<div>
|
};
|
||||||
{example}
|
export default App;
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export default App
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from "react";
|
||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from "react-dom";
|
||||||
|
|
||||||
import './index.css'
|
import "./index.css";
|
||||||
import App from './App'
|
import App from "./App";
|
||||||
|
|
||||||
ReactDOM.render(<App />, document.getElementById('root'))
|
ReactDOM.render(<App />, document.getElementById("root"));
|
||||||
|
|||||||
+5
-7
@@ -1,9 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from "react";
|
||||||
|
|
||||||
export const useMyHook = () => {
|
export const useMyHook = () => {
|
||||||
let [{
|
let [{ counter }, setState] = React.useState<{
|
||||||
counter
|
|
||||||
}, setState] = React.useState<{
|
|
||||||
counter: number;
|
counter: number;
|
||||||
}>({
|
}>({
|
||||||
counter: 0
|
counter: 0
|
||||||
@@ -12,12 +10,12 @@ export const useMyHook = () => {
|
|||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
let interval = window.setInterval(() => {
|
let interval = window.setInterval(() => {
|
||||||
counter++;
|
counter++;
|
||||||
setState({counter})
|
setState({ counter });
|
||||||
}, 1000)
|
}, 1000);
|
||||||
return () => {
|
return () => {
|
||||||
window.clearInterval(interval);
|
window.clearInterval(interval);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return counter;
|
return counter;
|
||||||
};
|
};
|
||||||
|
|||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
import { useMyHook } from './'
|
import { useMyHook } from "./";
|
||||||
|
|
||||||
describe('useMyHook', () => {
|
describe("useMyHook", () => {
|
||||||
it('is truthy', () => {
|
it("is truthy", () => {
|
||||||
expect(useMyHook).toBeTruthy()
|
expect(useMyHook).toBeTruthy();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user